Changeset 1869 for pjproject/trunk/pjnath/src/pjnath/turn_udp.c
- Timestamp:
- Mar 14, 2008 5:56:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/turn_udp.c
r1867 r1869 20 20 #include <pj/assert.h> 21 21 #include <pj/errno.h> 22 #include <pj/log.h> 22 23 #include <pj/pool.h> 23 24 #include <pj/ioqueue.h> … … 113 114 } 114 115 116 /* Bind to any */ 117 pj_sockaddr_init(af, &udp_rel->src_addr, NULL, 0); 118 status = pj_sock_bind(udp_rel->sock, &udp_rel->src_addr, 119 pj_sockaddr_get_len(&udp_rel->src_addr)); 120 if (status != PJ_SUCCESS) { 121 pj_turn_udp_destroy(udp_rel); 122 return status; 123 } 124 115 125 /* Register to ioqeuue */ 116 126 pj_bzero(&ioq_cb, sizeof(ioq_cb)); … … 256 266 pj_ssize_t bytes_read) 257 267 { 268 enum { MAX_RETRY = 10 }; 258 269 pj_turn_udp *udp_rel; 270 int retry = 0; 259 271 pj_status_t status; 260 272 … … 271 283 bytes_read = sizeof(udp_rel->pkt); 272 284 udp_rel->src_addr_len = sizeof(udp_rel->src_addr); 273 274 285 status = pj_ioqueue_recvfrom(udp_rel->key, op_key, 275 286 udp_rel->pkt, &bytes_read, 0, … … 277 288 &udp_rel->src_addr_len); 278 289 279 if (status != PJ_EPENDING && status != PJ_SUCCESS) 290 if (status != PJ_EPENDING && status != PJ_SUCCESS) { 291 char errmsg[PJ_ERR_MSG_SIZE]; 292 293 pj_strerror(status, errmsg, sizeof(errmsg)); 294 PJ_LOG(4,(udp_rel->pool->obj_name, 295 "ioqueue recvfrom error: %s", errmsg)); 296 280 297 bytes_read = -status; 281 282 } while (status != PJ_EPENDING && status != PJ_ECANCELLED); 298 } 299 300 } while (status != PJ_EPENDING && status != PJ_ECANCELLED && 301 ++retry < MAX_RETRY); 283 302 284 303 }
Note: See TracChangeset
for help on using the changeset viewer.