summaryrefslogtreecommitdiff
path: root/src/core/net-nonblock.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-09 21:26:50 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-09 21:26:50 +0000
commit8938a0f42b178a3bf26ad6976013ad57fb1e5bb2 (patch)
treebb2d5b6588d9db712f89e8d3159d8ece1d943e56 /src/core/net-nonblock.c
parent6358c2d62727113c15d389dd0e6460ba9a72f941 (diff)
downloadirssi-8938a0f42b178a3bf26ad6976013ad57fb1e5bb2.zip
/CONNECT, /SERVER: added -4 and -6 options for specifying if we should
connect to IPv4 or IPv6 address of the server. If -host or /SET hostname is set irssi determines from it if it should use IPv4 or v6. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1192 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/net-nonblock.c')
-rw-r--r--src/core/net-nonblock.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c
index 2b38e79b..4b9ab283 100644
--- a/src/core/net-nonblock.c
+++ b/src/core/net-nonblock.c
@@ -73,7 +73,7 @@ static int g_io_channel_read_block(GIOChannel *channel, void *data, int len)
/* nonblocking gethostbyname(), ip (IPADDR) + error (int, 0 = not error) is
written to pipe when found PID of the resolver child is returned */
-int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe)
+int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int family)
{
RESOLVED_IP_REC rec;
const char *errorstr;
@@ -100,7 +100,7 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe)
/* child */
memset(&rec, 0, sizeof(rec));
- rec.error = net_gethostbyname(addr, &rec.ip);
+ rec.error = net_gethostbyname(addr, &rec.ip, family);
if (rec.error == 0) {
errorstr = NULL;
} else {
@@ -239,7 +239,8 @@ int net_connect_nonblock(const char *server, int port, const IPADDR *my_ip,
rec->pipes[1] = g_io_channel_unix_new(fd[1]);
/* start nonblocking host name lookup */
- net_gethostbyname_nonblock(server, rec->pipes[1]);
+ net_gethostbyname_nonblock(server, rec->pipes[1],
+ my_ip == NULL ? 0 : my_ip->family);
rec->tag = g_input_add(rec->pipes[0], G_INPUT_READ,
(GInputFunction) simple_readpipe, rec);