From: <the...@us...> - 2006-08-12 22:16:26
|
Revision: 16728 Author: thekingant Date: 2006-08-12 15:16:23 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16728&view=rev Log Message: ----------- Extremely minor error message improvements Modified Paths: -------------- trunk/src/proxy.c Modified: trunk/src/proxy.c =================================================================== --- trunk/src/proxy.c 2006-08-12 21:13:25 UTC (rev 16727) +++ trunk/src/proxy.c 2006-08-12 22:16:23 UTC (rev 16728) @@ -297,6 +297,10 @@ * failed. This will be passed to the callback function * specified in the call to gaim_proxy_connect(). */ +/* + * TODO: Make sure all callers of this function pass a really really + * good error_message. + */ static void gaim_proxy_connect_info_error(GaimProxyConnectInfo *connect_info, const gchar *error_message) { @@ -1066,7 +1070,8 @@ fcntl(fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(fd, (struct sockaddr *)addr, addrlen) < 0) { + if (connect(fd, (struct sockaddr *)addr, addrlen) != 0) + { if ((errno == EINPROGRESS) || (errno == EINTR)) { /* This just confuses people. */ /* gaim_debug_warning("proxy", @@ -1085,7 +1090,8 @@ int error = ETIMEDOUT; gaim_debug_misc("proxy", "Connect didn't block.\n"); len = sizeof(error); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + { gaim_debug_error("proxy", "getsockopt failed.\n"); close(fd); return -1; @@ -1455,7 +1461,8 @@ fcntl(fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(fd, addr, addrlen) < 0) { + if (connect(fd, addr, addrlen) != 0) + { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_warning("http proxy", "Connect would have blocked.\n"); @@ -1481,7 +1488,8 @@ "Connect didn't block.\n"); len = sizeof(error); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + { close(fd); return -1; } @@ -1612,7 +1620,8 @@ fcntl(fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(fd, addr, addrlen) < 0) { + if (connect(fd, addr, addrlen) != 0) + { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_warning("socks4 proxy", "Connect would have blocked.\n"); @@ -1631,7 +1640,8 @@ len = sizeof(error); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + { close(fd); return -1; } @@ -2159,7 +2169,8 @@ fcntl(fd, F_SETFD, FD_CLOEXEC); #endif - if (connect(fd, addr, addrlen) < 0) { + if (connect(fd, addr, addrlen) != 0) + { if ((errno == EINPROGRESS) || (errno == EINTR)) { gaim_debug_warning("socks5 proxy", "Connect would have blocked.\n"); @@ -2179,7 +2190,8 @@ len = sizeof(error); - if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) + { close(fd); return -1; } @@ -2196,7 +2208,14 @@ struct sockaddr *addr; int ret = -1; - while (connect_info->hosts) { + if (connect_info->hosts == NULL) + { + gaim_proxy_connect_info_error(connect_info, _("Could not resolve host name")); + return; + } + + while (connect_info->hosts) + { addrlen = GPOINTER_TO_INT(connect_info->hosts->data); connect_info->hosts = g_slist_remove(connect_info->hosts, connect_info->hosts->data); addr = connect_info->hosts->data; @@ -2229,12 +2248,12 @@ g_free(addr); - if (ret > 0) + if (ret >= 0) break; } if (ret < 0) { - gaim_proxy_connect_info_error(connect_info, _("TODO")); + gaim_proxy_connect_info_error(connect_info, _("Unable to establish a connection")); } } @@ -2244,6 +2263,12 @@ { GaimProxyConnectInfo *connect_info; + if (error_message != NULL) + { + gaim_debug_info("proxy", "Error while resolving hostname: %s\n", error_message); + /* TODO: Destroy connect_info and return? */ + } + connect_info = data; connect_info->hosts = hosts; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |