summaryrefslogtreecommitdiff
path: root/pjlib/src/pjlib-test
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-06-17 13:31:13 +0000
committerBenny Prijono <bennylp@teluu.com>2009-06-17 13:31:13 +0000
commit6e6537f83260a1d4e976ea77e2803e1a2d3cf115 (patch)
tree7e99f679a1488a58ba877b3fbf70f516057417d3 /pjlib/src/pjlib-test
parent667d03f95abda64795c2064630cef48f843062f7 (diff)
Ticket #758 (Problem with TCP transport on Symbian)
- fixed TCP recv() to use RecvOneOrMore() - fixed activesock unit test in pjlib-test git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2771 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test')
-rw-r--r--pjlib/src/pjlib-test/activesock.c45
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)