diff options
Diffstat (limited to 'pjlib-util')
-rw-r--r-- | pjlib-util/src/pjlib-util/stun_simple_client.c | 15 | ||||
-rw-r--r-- | pjlib-util/src/pjlib-util/xml.c | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/pjlib-util/src/pjlib-util/stun_simple_client.c b/pjlib-util/src/pjlib-util/stun_simple_client.c index e4f0b0fe..dc13fe1a 100644 --- a/pjlib-util/src/pjlib-util/stun_simple_client.c +++ b/pjlib-util/src/pjlib-util/stun_simple_client.c @@ -44,7 +44,7 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, { unsigned srv_cnt; pj_sockaddr_in srv_addr[2]; - int i, send_cnt = 0; + int i, send_cnt = 0, nfds; pj_pool_t *pool; struct query_rec { struct { @@ -113,6 +113,17 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, TRACE_((THIS_FILE, " Done initialization.")); +#if defined(PJ_SELECT_NEEDS_NFDS) && PJ_SELECT_NEEDS_NFDS!=0 + nfds = -1; + for (i=0; i<sock_cnt; ++i) { + if (sock[i] > nfds) { + nfds = sock[i]; + } + } +#else + nfds = PJ_IOQUEUE_MAX_HANDLES-1; +#endif + /* Main retransmission loop. */ for (send_cnt=0; send_cnt<MAX_REQUEST; ++send_cnt) { pj_time_val next_tx, now; @@ -170,7 +181,7 @@ PJ_DEF(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf, PJ_FD_SET(sock[i], &r); } - select_rc = pj_sock_select(PJ_IOQUEUE_MAX_HANDLES, &r, NULL, NULL, &timeout); + select_rc = pj_sock_select(nfds+1, &r, NULL, NULL, &timeout); TRACE_((THIS_FILE, " select() rc=%d", select_rc)); if (select_rc < 1) continue; diff --git a/pjlib-util/src/pjlib-util/xml.c b/pjlib-util/src/pjlib-util/xml.c index 6bd3d93c..f1bfaf78 100644 --- a/pjlib-util/src/pjlib-util/xml.c +++ b/pjlib-util/src/pjlib-util/xml.c @@ -100,13 +100,13 @@ static pj_xml_node *xml_parse_node( pj_pool_t *pool, pj_scanner *scanner) pj_scan_get_char(scanner); /* Get node name. */ - pj_scan_get_until_chr( scanner, " />\t", &node->name); + pj_scan_get_until_chr( scanner, " />\t\r\n", &node->name); /* Get attributes. */ while (*scanner->curptr != '>' && *scanner->curptr != '/') { pj_xml_attr *attr = alloc_attr(pool); - pj_scan_get_until_chr( scanner, "=> \t", &attr->name); + pj_scan_get_until_chr( scanner, "=> \t\r\n", &attr->name); if (*scanner->curptr == '=') { pj_scan_get_char( scanner ); pj_scan_get_quotes(scanner, "\"'", "\"'", 2, &attr->value); |