Changeset 3491 for pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
- Timestamp:
- Mar 31, 2011 5:54:16 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
r3299 r3491 313 313 //write_op->op = 0; 314 314 } else if (write_op->op == PJ_IOQUEUE_OP_SEND_TO) { 315 send_rc = pj_sock_sendto(h->fd, 316 write_op->buf+write_op->written, 317 &sent, write_op->flags, 318 &write_op->rmt_addr, 319 write_op->rmt_addrlen); 315 int retry; 316 for (retry=0; retry<2; ++retry) { 317 send_rc = pj_sock_sendto(h->fd, 318 write_op->buf+write_op->written, 319 &sent, write_op->flags, 320 &write_op->rmt_addr, 321 write_op->rmt_addrlen); 322 #if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \ 323 PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 324 /* Special treatment for dead UDP sockets here, see ticket #1107 */ 325 if (send_rc==PJ_STATUS_FROM_OS(EPIPE) && !IS_CLOSING(h) && 326 h->fd_type==pj_SOCK_DGRAM()) 327 { 328 PJ_PERROR(4,(THIS_FILE, send_rc, 329 "Send error for socket %d, retrying", 330 h->fd)); 331 replace_udp_sock(h); 332 continue; 333 } 334 #endif 335 break; 336 } 337 320 338 /* Can't do this. We only clear "op" after we're finished sending 321 339 * the whole buffer. … … 918 936 struct write_operation *write_op; 919 937 unsigned retry; 938 #if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \ 939 PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 940 pj_bool_t restart_retry = PJ_FALSE; 941 #endif 920 942 pj_status_t status; 921 943 pj_ssize_t sent; … … 924 946 PJ_CHECK_STACK(); 925 947 948 retry_on_restart: 926 949 /* Check if key is closing. */ 927 950 if (IS_CLOSING(key)) … … 960 983 */ 961 984 if (status != PJ_STATUS_FROM_OS(PJ_BLOCKING_ERROR_VAL)) { 985 #if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \ 986 PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 987 /* Special treatment for dead UDP sockets here, see ticket #1107 */ 988 if (status==PJ_STATUS_FROM_OS(EPIPE) && !IS_CLOSING(key) && 989 key->fd_type==pj_SOCK_DGRAM() && !restart_retry) 990 { 991 PJ_PERROR(4,(THIS_FILE, status, 992 "Send error for socket %d, retrying", 993 key->fd)); 994 replace_udp_sock(key); 995 restart_retry = PJ_TRUE; 996 goto retry_on_restart; 997 } 998 #endif 999 962 1000 return status; 963 1001 }
Note: See TracChangeset
for help on using the changeset viewer.