From 6ccb637b0ad44a204fb0a9d27ed03a236100c8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Mih=C3=A1ly?= Date: Mon, 11 Apr 2016 12:59:50 +0000 Subject: [PATCH] clean/tidy code --- src/apps/natdiscovery/natdiscovery.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/apps/natdiscovery/natdiscovery.c b/src/apps/natdiscovery/natdiscovery.c index ad50cc7..867926d 100644 --- a/src/apps/natdiscovery/natdiscovery.c +++ b/src/apps/natdiscovery/natdiscovery.c @@ -218,7 +218,11 @@ static int run_stunclient(ioa_addr *remote_addr, ioa_addr *reflexive_addr, ioa_a printf("The response is not a reponse message\n"); } } catch(...) { - printf("The response is not a well formed STUN message\n"); + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { + printf("STUN receive timeout..\n"); + }else{ + printf("The response is not a well formed STUN message\n"); + } ret=1; } } @@ -301,13 +305,6 @@ static int run_stunclient(ioa_addr *remote_addr, ioa_addr *reflexive_addr, ioa_a ptr += len; break; } - if (errno == EINTR) - printf("EINTR"); - if (errno == EAGAIN) - printf("EAGAIN"); - if (errno == EWOULDBLOCK) - printf("EWOULDBLOCK"); - } while (len < 0 && (errno == EINTR)); if (recvd > 0) @@ -362,7 +359,11 @@ static int run_stunclient(ioa_addr *remote_addr, ioa_addr *reflexive_addr, ioa_a ret=1; } } else { - printf("The response is not a STUN message\n"); + if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { + printf("STUN receive timeout..\n"); + }else{ + printf("The response is not a STUN message\n"); + } ret=1; } }