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:
Benny Prijono 2007-10-07 06:04:28 +00:00
parent 05ec487eec
commit c916316c8b
3 changed files with 4 additions and 1 deletions

View File

@ -115,6 +115,7 @@ int main(int argc, char *argv[])
pj_init();
pjlib_util_init();
pjnath_init();
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
status = pj_stun_server_create(&cp.factory, 1, &srv);

View File

@ -1390,7 +1390,7 @@ static void client_on_read_complete(pj_ioqueue_key_t *key,
/* Received data from peer! */
client_handle_peer_data(client, bytes_read);
} else if (bytes_read < 0) {
} else if (bytes_read <= 0) {
char errmsg[PJ_ERR_MSG_SIZE];
pj_strerror(-bytes_read, errmsg, sizeof(errmsg));
PJ_LOG(4,(THIS_FILE, "TURN client %s: error reading data "

View File

@ -267,6 +267,8 @@ static void on_read_complete(pj_ioqueue_key_t *key,
&worker->src_addr, &worker->src_addr_len);
if (status == PJ_EPENDING)
break;
else if (status != PJ_SUCCESS)
bytes_read = -status;
}
}