From d83c1650919d0a9910707c7aa96768da147b2d26 Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Tue, 5 Aug 2014 13:33:59 +0900 Subject: [PATCH] tethering: fix connection failure case. when connection is failure, it will escape the while loop. Change-Id: Ifaef1e732037eba107cfde4ae034ce3d06a28f2c Signed-off-by: Kitae Kim --- tizen/src/tethering/common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tizen/src/tethering/common.c b/tizen/src/tethering/common.c index 201b9e4..045935c 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) { 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; INFO("a previous connection has not yet been completed\n"); + ret = 0; continue; } else if (connection_errno == EISCONN) { - ret = 0; INFO("connection is already connected\n"); + ret = 0; break; } else { perror("connect failure"); ret = -connection_errno; + break; } } } -- 2.7.4