From: Kitae Kim Date: Thu, 31 Jul 2014 02:40:15 +0000 (+0900) Subject: tethering: fix connection failure case. X-Git-Tag: TizenStudio_2.0_p3.0~398^2~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f99ccc5971bc4e61553dd71bc1051864b812f67;p=sdk%2Femulator%2Fqemu.git tethering: fix connection failure case. when connection is failure, it will escape the while loop. Change-Id: I134976425971f6552b7787d8357424de4b40737d Signed-off-by: Kitae Kim --- diff --git a/tizen/src/tethering/common.c b/tizen/src/tethering/common.c index 9f368b6..408d919 100644 --- a/tizen/src/tethering/common.c +++ b/tizen/src/tethering/common.c @@ -196,7 +196,6 @@ bool send_msg_to_controller(void *msg) if (sent_size < 0) { perror("failed to send a packet"); if (errno == EAGAIN) { - //sleep(1); fd_set writefds; struct timeval timeout; @@ -640,9 +639,9 @@ static int start_tethering_socket(const char *ipaddress, int port) set_tethering_connection_status(CONNECTING); while (1) { - ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); + ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); - if (ret == 0) { + if (ret == 0) { LOG_INFO("tethering socket is connected.\n"); break; } else { @@ -675,16 +674,17 @@ static int start_tethering_socket(const char *ipaddress, int port) } continue; } else if (connection_errno == EALREADY) { - ret = 0; LOG_INFO("a previous connection has not yet been completed\n"); + ret = 0; continue; } else if (connection_errno == EISCONN) { - ret = 0; LOG_INFO("connection is already connected\n"); + ret = 0; break; } else { perror("connect failure"); ret = -connection_errno; + break; } } }