[Commits] socket.c 1.13.2.49 1.13.2.50

colin at claws-mail.org colin at claws-mail.org
Wed Sep 19 11:45:35 CEST 2012


Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv21289/src/common

Modified Files:
      Tag: gtk2
	socket.c 
Log Message:
2012-09-19 [colin]	3.8.1cvs61

	* src/imap.c
	* src/inc.c
	* src/news.c
	* src/send_message.c
	* src/common/socket.c
		More precise error logging

Index: socket.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/socket.c,v
retrieving revision 1.13.2.49
retrieving revision 1.13.2.50
diff -u -d -r1.13.2.49 -r1.13.2.50
--- socket.c	7 Jul 2012 07:09:31 -0000	1.13.2.49
+++ socket.c	19 Sep 2012 09:45:32 -0000	1.13.2.50
@@ -570,6 +570,7 @@
 		return 0;
 	} else {
 		g_warning("Socket IO timeout\n");
+		log_error(LOG_PROTOCOL, _("Socket IO timeout.\n"));
 		return -1;
 	}
 }
@@ -598,6 +599,7 @@
 		alarm(0);
 		signal(SIGALRM, prev_handler);
 		errno = ETIMEDOUT;
+		log_error(LOG_PROTOCOL, _("Connection timed out.\n"));
 		return -1;
 	}
 	alarm(timeout_secs);
@@ -625,6 +627,7 @@
 		alarm(0);
 		signal(SIGALRM, prev_handler);
 		g_printerr("%s: host lookup timed out.\n", hostname);
+		log_error(LOG_PROTOCOL, _("%s: host lookup timed out.\n"), hostname);
 		errno = 0;
 		return NULL;
 	}
@@ -637,6 +640,7 @@
 		signal(SIGALRM, prev_handler);
 #endif
 		g_printerr("%s: unknown host.\n", hostname);
+		log_error(LOG_PROTOCOL, _("%s: unknown host.\n"), hostname);
 		errno = 0;
 		return NULL;
 	}
@@ -824,6 +828,9 @@
 
 	if (val != 0) {
 		close(fd);
+		log_error(LOG_PROTOCOL, _("%s:%d: connection failed (%s).\n"),
+			  conn_data->hostname, conn_data->port,
+			  strerror(val));
 		sock_connect_address_list_async(conn_data);
 		return FALSE;
 	}
@@ -948,6 +955,7 @@
 		if ((sock = socket(addr_data->family, addr_data->socktype,
 				   addr_data->protocol)) < 0) {
 			perror("socket");
+
 			continue;
 		}
 
@@ -960,14 +968,12 @@
 				perror("connect");
 				close(sock);
 			}
-		} else
+		} else {
 			break;
+		}
 	}
 
 	if (conn_data->cur_addr == NULL) {
-		g_warning("sock_connect_address_list_async: "
-			  "connection to %s:%d failed\n",
-			  conn_data->hostname, conn_data->port);
 		conn_data->func(NULL, conn_data->data);
 		sock_connect_async_cancel(conn_data->id);
 		return -1;
@@ -1062,6 +1068,8 @@
 
 		if (ai_member[0] == AF_UNSPEC) {
 			g_warning("DNS lookup failed\n");
+			log_error(LOG_PROTOCOL, _("%s:%d: unknown host.\n"),
+				lookup_data->hostname, lookup_data->port);
 			break;
 		}
 
@@ -1155,6 +1163,8 @@
 		gchar len = 0;
                 g_warning("getaddrinfo for %s:%s failed: %s\n",
                           parm->hostname, port_str, gai_strerror(gai_err));
+		log_error(LOG_PROTOCOL, _("%s:%s: host lookup failed (%s).\n"),
+			  parm->hostname, port_str, gai_strerror(gai_err));
 	        fd_write_all(parm->pipe_fds[1], &len,
                      sizeof(len));
                 fd_write_all(parm->pipe_fds[1], (gchar *)ai_member,



More information about the Commits mailing list