Changeset 4343 for pjproject/trunk/pjnath/src/pjnath/stun_sock.c
- Timestamp:
- Feb 7, 2013 9:35:34 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/src/pjnath/stun_sock.c
r4324 r4343 33 33 34 34 35 enum { MAX_BIND_RETRY = 100 }; 36 35 37 struct pj_stun_sock 36 38 { … … 163 165 pj_stun_sock *stun_sock; 164 166 pj_stun_sock_cfg default_cfg; 167 pj_sockaddr bound_addr; 165 168 unsigned i; 169 pj_uint16_t max_bind_retry; 166 170 pj_status_t status; 167 171 … … 212 216 213 217 /* Bind socket */ 214 if (pj_sockaddr_has_addr(&cfg->bound_addr)) {215 status = pj_sock_bind(stun_sock->sock_fd, &cfg->bound_addr, 216 pj_sockaddr_get_len(&cfg->bound_addr));217 } else {218 pj_sockaddr bound_addr; 219 220 pj_sockaddr_init(af, &bound_addr, NULL, 0); 221 status = pj_sock_bind(stun_sock->sock_fd, &bound_addr,222 pj_sockaddr_get_len(&bound_addr)); 223 }224 218 max_bind_retry = MAX_BIND_RETRY; 219 if (cfg->port_range && cfg->port_range < max_bind_retry) 220 max_bind_retry = cfg->port_range; 221 pj_sockaddr_init(af, &bound_addr, NULL, 0); 222 if (cfg->bound_addr.addr.sa_family == pj_AF_INET() || 223 cfg->bound_addr.addr.sa_family == pj_AF_INET6()) 224 { 225 pj_sockaddr_cp(&bound_addr, &cfg->bound_addr); 226 } 227 status = pj_sock_bind_random(stun_sock->sock_fd, &bound_addr, 228 cfg->port_range, max_bind_retry); 225 229 if (status != PJ_SUCCESS) 226 230 goto on_error;
Note: See TracChangeset
for help on using the changeset viewer.