diff --git a/src/syncterm/conn.c b/src/syncterm/conn.c
index 5bb0b6d12dc458cb8656a894c31d9549f6ee91e4..0ff2794eecd4afa9236fd4c734d0ab9e3524ffd5 100644
--- a/src/syncterm/conn.c
+++ b/src/syncterm/conn.c
@@ -419,6 +419,7 @@ int conn_socket_connect(struct bbslist *bbs)
 	struct addrinfo	*res=NULL;
 	struct addrinfo	*cur;
 	char			portnum[6];
+	char str[LIST_ADDR_MAX+40];
 
 	uifc.pop("Looking up host");
 	memset(&hints, 0, sizeof(hints));
@@ -445,7 +446,6 @@ int conn_socket_connect(struct bbslist *bbs)
 	if(getaddrinfo(bbs->addr, portnum, &hints, &res)!=0) {
 		failcode=FAILURE_RESOLVE;
 		res=NULL;
-		goto connect_failed;
 	}
 	uifc.pop(NULL);
 	uifc.pop("Connecting...");
@@ -453,12 +453,13 @@ int conn_socket_connect(struct bbslist *bbs)
 	/* Drain the input buffer to avoid accidental cancel */
 	while(kbhit())
 		getch();
-	for(cur=res; cur && failcode==FAILURE_WHAT_FAILURE; cur=cur->ai_next) {
+
+	for(cur=res; cur && sock == INVALID_SOCKET && failcode == FAILURE_WHAT_FAILURE; cur=cur->ai_next) {
 		if(sock==INVALID_SOCKET) {
 			sock=socket(cur->ai_family, cur->ai_socktype, cur->ai_protocol);
 			if(sock==INVALID_SOCKET) {
 				failcode=FAILURE_CANT_CREATE;
-				goto connect_failed;
+				break;
 			}
 			/* Set to non-blocking for the connect */
 			nonblock=-1;
@@ -485,7 +486,8 @@ int conn_socket_connect(struct bbslist *bbs)
 							case 0:
 								if(kbhit()) {
 									failcode=FAILURE_ABORTED;
-									goto connect_failed;
+									closesocket(sock);
+									sock=INVALID_SOCKET;
 								}
 								break;
 							case -1:
@@ -510,6 +512,7 @@ int conn_socket_connect(struct bbslist *bbs)
 						}
 					}
 
+connected:
 					break;
 				default:
 					closesocket(sock);
@@ -517,76 +520,64 @@ int conn_socket_connect(struct bbslist *bbs)
 					continue;
 			}
 		}
-		else
-			goto connected;
-	}
-	if(!cur) {
-		failcode=FAILURE_CONNECT_ERROR;
-		goto connect_failed;
 	}
-	if(failcode != FAILURE_WHAT_FAILURE)
-		goto connect_failed;
-
-connected:
-	freeaddrinfo(res);
-	res=NULL;
-	nonblock=0;
-	ioctlsocket(sock, FIONBIO, &nonblock);
-	if(!socket_check(sock, NULL, NULL, 0)) {
+	if (sock != INVALID_SOCKET) {
+		freeaddrinfo(res);
+		res=NULL;
+		nonblock=0;
+		ioctlsocket(sock, FIONBIO, &nonblock);
+		if(socket_check(sock, NULL, NULL, 0)) {
+			int keepalives = TRUE;
+			setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalives, sizeof(keepalives));
+
+			uifc.pop(NULL);
+			return(sock);
+		}
 		failcode=FAILURE_DISCONNECTED;
-		goto connect_failed;
 	}
-	int keepalives = TRUE;
-	setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalives, sizeof(keepalives));
-
-	uifc.pop(NULL);
-	return(sock);
+	if (failcode == FAILURE_WHAT_FAILURE)
+		failcode=FAILURE_CONNECT_ERROR;
 
-connect_failed:
 	if(res)
 		freeaddrinfo(res);
-	{
-		char str[LIST_ADDR_MAX+40];
-
-		uifc.pop(NULL);
-		conn_api.terminate=-1;
-		switch(failcode) {
-			case FAILURE_RESOLVE:
-				sprintf(str,"Cannot resolve %s!",bbs->addr);
-				uifcmsg(str,	"`Cannot Resolve Host`\n\n"
-								"The system is unable to resolve the hostname... double check the spelling.\n"
-								"If it's not an issue with your DNS settings, the issue is probobly\n"
-								"with the DNS settings of the system you are trying to contact.");
-				break;
-			case FAILURE_CANT_CREATE:
-				sprintf(str,"Cannot create socket (%d)!",ERROR_VALUE);
-				uifcmsg(str,
-								"`Unable to create socket`\n\n"
-								"Your system is either dangerously low on resources, or there\n"
-								"is a problem with your TCP/IP stack.");
-				break;
-			case FAILURE_CONNECT_ERROR:
-				sprintf(str,"Connect error (%d)!",ERROR_VALUE);
-				uifcmsg(str
-								,"`The connect call returned an error`\n\n"
-								 "The call to connect() returned an unexpected error code.");
-				break;
-			case FAILURE_ABORTED:
-				uifcmsg("Connection Aborted.",	"`Connection Aborted`\n\n"
-								"Connection to the remote system aborted by keystroke.");
-				break;
-			case FAILURE_DISCONNECTED:
-				sprintf(str,"Connect error (%d)!",ERROR_VALUE);
-				uifcmsg(str
-								,"`SyncTERM failed to connect`\n\n"
-								 "After connect() succeeded, the socket was in a disconnected state.");
-				break;
-		}
-		conn_close();
-		if (sock != INVALID_SOCKET)
-		closesocket(sock);
-		return(INVALID_SOCKET);
+	uifc.pop(NULL);
+	conn_api.terminate=-1;
+	switch(failcode) {
+		case FAILURE_RESOLVE:
+			sprintf(str,"Cannot resolve %s!",bbs->addr);
+			uifcmsg(str,	"`Cannot Resolve Host`\n\n"
+							"The system is unable to resolve the hostname... double check the spelling.\n"
+							"If it's not an issue with your DNS settings, the issue is probobly\n"
+							"with the DNS settings of the system you are trying to contact.");
+			break;
+		case FAILURE_CANT_CREATE:
+			sprintf(str,"Cannot create socket (%d)!",ERROR_VALUE);
+			uifcmsg(str,
+							"`Unable to create socket`\n\n"
+							"Your system is either dangerously low on resources, or there\n"
+							"is a problem with your TCP/IP stack.");
+			break;
+		case FAILURE_CONNECT_ERROR:
+			sprintf(str,"Connect error (%d)!",ERROR_VALUE);
+			uifcmsg(str
+							,"`The connect call returned an error`\n\n"
+							 "The call to connect() returned an unexpected error code.");
+			break;
+		case FAILURE_ABORTED:
+			uifcmsg("Connection Aborted.",	"`Connection Aborted`\n\n"
+							"Connection to the remote system aborted by keystroke.");
+			break;
+		case FAILURE_DISCONNECTED:
+			sprintf(str,"Connect error (%d)!",ERROR_VALUE);
+			uifcmsg(str
+							,"`SyncTERM failed to connect`\n\n"
+							 "After connect() succeeded, the socket was in a disconnected state.");
+			break;
 	}
+	conn_close();
+	if (sock != INVALID_SOCKET)
+		closesocket(sock);
+	return(INVALID_SOCKET);
 }
 
 void conn_binary_mode_on(void)