summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-22 21:11:10 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-22 21:11:10 +0000
commita8a95675cba90ecd5ba2b7b36432641d4bf5703d (patch)
tree5152fce018768fc81ca81714509b09545e420de1
parent3e51d83ffd41ea71ef0d1336b9c86b4f74192e43 (diff)
Fixed ticket #285: ICE transport stops receiving packet upon getting ICMP unreach on Windows
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1288 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjnath/src/pjnath-test/ice_test.c11
-rw-r--r--pjnath/src/pjnath-test/test.c2
-rw-r--r--pjnath/src/pjnath/ice_strans.c20
3 files changed, 24 insertions, 9 deletions
diff --git a/pjnath/src/pjnath-test/ice_test.c b/pjnath/src/pjnath-test/ice_test.c
index 2933a088..38bb6d02 100644
--- a/pjnath/src/pjnath-test/ice_test.c
+++ b/pjnath/src/pjnath-test/ice_test.c
@@ -292,8 +292,10 @@ static int perform_ice_test(const char *title,
/* Start ICE on im2 */
status = start_ice(im2, im1);
- if (status != PJ_SUCCESS)
+ if (status != PJ_SUCCESS) {
+ app_perror(" error starting ICE", status);
return -30;
+ }
/* Start ICE on im1 */
status = start_ice(im1, im2);
@@ -328,8 +330,10 @@ static int perform_ice_test(const char *title,
data_from_answerer = pj_str("from answerer");
status = pj_ice_sess_send_data(im2->ice, 1, data_from_answerer.ptr, data_from_answerer.slen);
- if (status != PJ_SUCCESS)
+ if (status != PJ_SUCCESS) {
+ app_perror(" error sending packet", status);
return -48;
+ }
/* Poll to allow data to be received */
for (;;) {
@@ -476,9 +480,12 @@ int ice_test(void)
goto on_return;
/* Failure case (all checks fail) */
+#if 0
+ /* Cannot just add an SRFLX candidate; it needs a base */
rc = perform_ice_test("Failure case (all checks fail)", PJ_FALSE, 1, PJ_FALSE, D3, D3, 1, ocand, 1, acand);
if (rc != 0)
goto on_return;
+#endif
/* Direct communication with invalid address */
rc = perform_ice_test("With 1 unreachable address", PJ_TRUE, 1, PJ_TRUE, D1, D2, 1, ocand, 0, NULL);
diff --git a/pjnath/src/pjnath-test/test.c b/pjnath/src/pjnath-test/test.c
index 1542bcdd..b9776539 100644
--- a/pjnath/src/pjnath-test/test.c
+++ b/pjnath/src/pjnath-test/test.c
@@ -64,6 +64,8 @@ static int test_inner(void)
pj_dump_config();
pj_caching_pool_init( &caching_pool, &pj_pool_factory_default_policy, 0 );
+ pjnath_init();
+
#if INCLUDE_ICE_TEST
DO_TEST(ice_test());
#endif
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 16e8e96e..df5086f9 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -440,6 +440,8 @@ static void on_read_complete(pj_ioqueue_key_t *key,
pj_ioqueue_get_user_data(key);
pj_ice_strans *ice_st = comp->ice_st;
pj_ssize_t pkt_size;
+ enum { RETRY = 4 };
+ unsigned retry;
pj_status_t status;
if (bytes_read > 0) {
@@ -511,13 +513,17 @@ static void on_read_complete(pj_ioqueue_key_t *key,
}
/* Read next packet */
- pkt_size = sizeof(comp->pkt);
- comp->src_addr_len = sizeof(comp->src_addr);
- status = pj_ioqueue_recvfrom(key, op_key, comp->pkt, &pkt_size,
- PJ_IOQUEUE_ALWAYS_ASYNC,
- &comp->src_addr, &comp->src_addr_len);
- if (status != PJ_SUCCESS && status != PJ_EPENDING) {
- ice_st_perror(comp->ice_st, "ioqueue recvfrom() error", status);
+ for (retry=0; retry<RETRY; ++retry) {
+ pkt_size = sizeof(comp->pkt);
+ comp->src_addr_len = sizeof(comp->src_addr);
+ status = pj_ioqueue_recvfrom(key, op_key, comp->pkt, &pkt_size,
+ PJ_IOQUEUE_ALWAYS_ASYNC,
+ &comp->src_addr, &comp->src_addr_len);
+ if (status != PJ_SUCCESS && status != PJ_EPENDING) {
+ ice_st_perror(comp->ice_st, "ioqueue recvfrom() error", status);
+ } else {
+ break;
+ }
}
}