Minor fixes to TURN server: handle immediate recv() error, call pjnath_init() in main(), etc.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1485 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
05ec487eec
commit
c916316c8b
3 changed files with 4 additions and 1 deletions
|
@ -115,6 +115,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pj_init();
|
pj_init();
|
||||||
pjlib_util_init();
|
pjlib_util_init();
|
||||||
|
pjnath_init();
|
||||||
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
|
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
|
||||||
|
|
||||||
status = pj_stun_server_create(&cp.factory, 1, &srv);
|
status = pj_stun_server_create(&cp.factory, 1, &srv);
|
||||||
|
|
|
@ -1390,7 +1390,7 @@ static void client_on_read_complete(pj_ioqueue_key_t *key,
|
||||||
/* Received data from peer! */
|
/* Received data from peer! */
|
||||||
client_handle_peer_data(client, bytes_read);
|
client_handle_peer_data(client, bytes_read);
|
||||||
|
|
||||||
} else if (bytes_read < 0) {
|
} else if (bytes_read <= 0) {
|
||||||
char errmsg[PJ_ERR_MSG_SIZE];
|
char errmsg[PJ_ERR_MSG_SIZE];
|
||||||
pj_strerror(-bytes_read, errmsg, sizeof(errmsg));
|
pj_strerror(-bytes_read, errmsg, sizeof(errmsg));
|
||||||
PJ_LOG(4,(THIS_FILE, "TURN client %s: error reading data "
|
PJ_LOG(4,(THIS_FILE, "TURN client %s: error reading data "
|
||||||
|
|
|
@ -267,6 +267,8 @@ static void on_read_complete(pj_ioqueue_key_t *key,
|
||||||
&worker->src_addr, &worker->src_addr_len);
|
&worker->src_addr, &worker->src_addr_len);
|
||||||
if (status == PJ_EPENDING)
|
if (status == PJ_EPENDING)
|
||||||
break;
|
break;
|
||||||
|
else if (status != PJ_SUCCESS)
|
||||||
|
bytes_read = -status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue