summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2004-01-07 07:54:38 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-01-07 07:54:38 +0000
commitfd6c38d22e8f54fae198d4bdd98c6b1dd37589a9 (patch)
tree1b1c7fe7ac6cd0c812a8a124946285ec67a40444 /src/core
parent1cbd975b2d55a4e7796785494a37fda22914836b (diff)
downloadirssi-fd6c38d22e8f54fae198d4bdd98c6b1dd37589a9.zip
If we can't connect to server using given IP, show the IP to user in the
error message. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3197 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/servers.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/core/servers.c b/src/core/servers.c
index 85bc203b..ca18914a 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -171,7 +171,10 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
const char *unix_socket)
{
GIOChannel *handle;
- IPADDR *own_ip;
+ IPADDR *own_ip = NULL;
+ const char *errmsg;
+ char *errmsg2;
+ char ipaddr[MAX_IP_LEN];
int port;
g_return_if_fail(ip != NULL || unix_socket != NULL);
@@ -197,12 +200,22 @@ server->connrec->ssl_cafile, server->connrec->ssl_capath, server->connrec->ssl_v
if (handle == NULL) {
/* failed */
- if (errno == EADDRNOTAVAIL ||
- (server->connrec->use_ssl && errno == ENOSYS))
+ errmsg = g_strerror(errno);
+ errmsg2 = NULL;
+ if (errno == EADDRNOTAVAIL) {
+ if (own_ip != NULL) {
+ /* show the IP which is causing the error */
+ net_ip2host(own_ip, ipaddr);
+ errmsg2 = g_strconcat(errmsg, ": ", ipaddr, NULL);
+ }
+ server->no_reconnect = TRUE;
+ }
+ if (server->connrec->use_ssl && errno == ENOSYS)
server->no_reconnect = TRUE;
server->connection_lost = TRUE;
- server_connect_failed(server, g_strerror(errno));
+ server_connect_failed(server, errmsg2 ? errmsg2 : errmsg);
+ g_free(errmsg2);
} else {
server->handle = net_sendbuffer_create(handle, 0);
server->connect_tag =