diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-06-25 12:26:15 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-06-25 12:26:15 +0000 |
commit | 8aa394284dcd2ec0d32c917599df1481d3a22706 (patch) | |
tree | cc1470aeface24bbea2e7c2989b8c8d105d80713 /pjlib/src/pjlib-test | |
parent | c3ec0081c7a6e5622e9748a48561d064f53e9831 (diff) |
Ticket #759: Problem with TCP transport on Symbian
- backported changes in #758
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.0@2804 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r-- | pjlib/src/pjlib-test/activesock.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/pjlib/src/pjlib-test/activesock.c b/pjlib/src/pjlib-test/activesock.c index 0d1d3a22..9390d917 100644 --- a/pjlib/src/pjlib-test/activesock.c +++ b/pjlib/src/pjlib-test/activesock.c @@ -212,7 +212,11 @@ static int udp_ping_pong_test(void) for (i=0; i<10 && last_rx1 == srv1->rx_cnt && last_rx2 == srv2->rx_cnt; ++i) { pj_time_val delay = {0, 10}; +#ifdef PJ_SYMBIAN + pj_symbianos_poll(-1, 100); +#else pj_ioqueue_poll(ioqueue, &delay); +#endif } if (srv1->rx_err_cnt+srv1->tx_err_cnt != 0 || @@ -403,26 +407,47 @@ static int tcp_perf_test(void) status = pj_activesock_send(asock2, &op_key->op_key, pkt, &len, 0); if (status == PJ_EPENDING) { do { +#if PJ_SYMBIAN + pj_symbianos_poll(-1, -1); +#else pj_ioqueue_poll(ioqueue, NULL); +#endif } while (!state2->sent); - } else if (status != PJ_SUCCESS) { - PJ_LOG(1,("", " err: send status=%d", status)); - status = -180; - break; - } else if (status == PJ_SUCCESS) { - if (len != sizeof(*pkt)) { - PJ_LOG(1,("", " err: shouldn't report partial sent")); - status = -190; - break; - } + } else { +#if PJ_SYMBIAN + /* The Symbian socket always returns PJ_SUCCESS for TCP send, + * eventhough the remote end hasn't received the data yet. + * If we continue sending, eventually send() will block, + * possibly because the send buffer is full. So we need to + * poll the ioqueue periodically, to let receiver gets the + * data. + */ + pj_symbianos_poll(-1, 0); +#endif + if (status != PJ_SUCCESS) { + PJ_LOG(1,("", " err: send status=%d", status)); + status = -180; + break; + } else if (status == PJ_SUCCESS) { + if (len != sizeof(*pkt)) { + PJ_LOG(1,("", " err: shouldn't report partial sent")); + status = -190; + break; + } + } } } /* Wait until everything has been sent/received */ if (state1->next_recv_seq < COUNT) { +#ifdef PJ_SYMBIAN + while (pj_symbianos_poll(-1, 1000) == PJ_TRUE) + ; +#else pj_time_val delay = {0, 100}; while (pj_ioqueue_poll(ioqueue, &delay) > 0) ; +#endif } if (status == PJ_EPENDING) |