diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-05-03 19:56:21 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-05-03 19:56:21 +0000 |
commit | 0a2d5c3cd9d32c77fcf23976736324ebb0565d44 (patch) | |
tree | bebc99d373b81095046eda50cc6383040beb8835 /pjsip | |
parent | abb1aee315f44c03cc3da3627a93651cdd9ca15e (diff) |
Misc Symbian fixes, looks good
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1248 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsip/sip_transport.h | 10 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_transport.c | 22 | ||||
-rw-r--r-- | pjsip/src/pjsip/sip_transport_udp.c | 9 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 14 |
4 files changed, 52 insertions, 3 deletions
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h index a9be1721..5137ef70 100644 --- a/pjsip/include/pjsip/sip_transport.h +++ b/pjsip/include/pjsip/sip_transport.h @@ -932,6 +932,16 @@ PJ_DECL(pj_status_t) pjsip_tpmgr_find_local_addr( pjsip_tpmgr *tpmgr, pj_str_t *ip_addr, int *port); +/** + * Return number of transports currently registered to the transport + * manager. + * + * @param mgr The transport manager. + * + * @return Number of transports. + */ +PJ_DECL(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr); + /** * Destroy transport manager. diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c index ee42699b..afe0f1e4 100644 --- a/pjsip/src/pjsip/sip_transport.c +++ b/pjsip/src/pjsip/sip_transport.c @@ -1011,6 +1011,28 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_find_local_addr( pjsip_tpmgr *tpmgr, return PJ_SUCCESS; } +/* + * Return number of transports currently registered to the transport + * manager. + */ +PJ_DEF(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr) +{ + pj_hash_iterator_t itr_val; + pj_hash_iterator_t *itr; + int nr_of_transports = 0; + + pj_lock_acquire(mgr->lock); + + itr = pj_hash_first(mgr->table, &itr_val); + while (itr) { + nr_of_transports++; + itr = pj_hash_next(mgr->table, itr); + } + + pj_lock_release(mgr->lock); + + return nr_of_transports; +} /* * pjsip_tpmgr_destroy() diff --git a/pjsip/src/pjsip/sip_transport_udp.c b/pjsip/src/pjsip/sip_transport_udp.c index 42e001da..02b86fbb 100644 --- a/pjsip/src/pjsip/sip_transport_udp.c +++ b/pjsip/src/pjsip/sip_transport_udp.c @@ -129,10 +129,13 @@ static void udp_on_read_complete( pj_ioqueue_key_t *key, * complete asynchronously, to allow other sockets to get their data. */ for (i=0;; ++i) { + enum { MIN_SIZE = 32 }; pj_uint32_t flags; - /* Report the packet to transport manager. */ - if (bytes_read > 0) { + /* Report the packet to transport manager. Only do so if packet size + * is relatively big enough for a SIP packet. + */ + if (bytes_read > MIN_SIZE) { pj_size_t size_eaten; const pj_sockaddr_in *src_addr = (pj_sockaddr_in*)&rdata->pkt_info.src_addr; @@ -157,7 +160,7 @@ static void udp_on_read_complete( pj_ioqueue_key_t *key, /* Since this is UDP, the whole buffer is the message. */ rdata->pkt_info.len = 0; - } else if (bytes_read == 0) { + } else if (bytes_read <= MIN_SIZE) { /* TODO: */ diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 34691531..162d2da9 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -646,6 +646,10 @@ on_error: static void busy_sleep(unsigned msec) { #if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 + /* Ideally we shouldn't call pj_thread_sleep() and rather + * CActiveScheduler::WaitForAnyRequest() here, but that will + * drag in Symbian header and it doesn't look pretty. + */ pj_thread_sleep(msec); #else pj_time_val timeout, now; @@ -975,6 +979,15 @@ PJ_DEF(pj_status_t) pjsua_start(void) */ PJ_DEF(int) pjsua_handle_events(unsigned msec_timeout) { +#if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 + /* Ideally we shouldn't call pj_thread_sleep() and rather + * CActiveScheduler::WaitForAnyRequest() here, but that will + * drag in Symbian header and it doesn't look pretty. + */ + pj_thread_sleep(msec_timeout); + return msec_timeout; +#else + unsigned count = 0; pj_time_val tv; pj_status_t status; @@ -989,6 +1002,7 @@ PJ_DEF(int) pjsua_handle_events(unsigned msec_timeout) return -status; return count; +#endif } |