summaryrefslogtreecommitdiff
path: root/src/irc/irc-dcc.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-08-26 22:32:02 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-08-26 22:32:02 +0000
commit767e378c533198355addf36ac968aea631714824 (patch)
tree0c3ff59e3032793cdcde5535c5abcef8b911cfe6 /src/irc/irc-dcc.c
parent60503d9383adfc0c0aff9e020aaf5f7b8bdc6f3f (diff)
downloadweechat-767e378c533198355addf36ac968aea631714824.zip
Set non blockant socket for dcc connection (as it was made before)
Diffstat (limited to 'src/irc/irc-dcc.c')
-rw-r--r--src/irc/irc-dcc.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index 985bedcb5..98252c4d6 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -264,35 +264,32 @@ dcc_connect (t_irc_dcc *ptr_dcc)
/* for receiving (chat or file), connect to listening host */
if (DCC_IS_RECV(ptr_dcc->type))
{
- if (cfg_proxy_use)
+ if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
+ return 0;
+ if (cfg_proxy_use)
{
- memset (&addr, 0, sizeof (addr));
- addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
- ip4 = inet_ntoa(addr.sin_addr);
-
- memset (&addr, 0, sizeof (addr));
- addr.sin_port = htons (cfg_proxy_port);
- addr.sin_family = AF_INET;
- if ((hostent = gethostbyname (cfg_proxy_address)) == NULL)
- return 0;
- memcpy(&(addr.sin_addr),*(hostent->h_addr_list), sizeof(struct in_addr));
+ memset (&addr, 0, sizeof (addr));
+ addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
+ ip4 = inet_ntoa(addr.sin_addr);
- if (connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)) == -1)
- return 0;
- if (pass_proxy(ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1)
- return 0;
+ memset (&addr, 0, sizeof (addr));
+ addr.sin_port = htons (cfg_proxy_port);
+ addr.sin_family = AF_INET;
+ if ((hostent = gethostbyname (cfg_proxy_address)) == NULL)
+ return 0;
+ memcpy(&(addr.sin_addr),*(hostent->h_addr_list), sizeof(struct in_addr));
+ connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
+ if (pass_proxy(ptr_dcc->sock, ip4, ptr_dcc->port, ptr_dcc->server->username) == -1)
+ return 0;
}
- else
+ else
{
- memset (&addr, 0, sizeof (addr));
- addr.sin_port = htons (ptr_dcc->port);
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
- if (connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr)) == -1)
- return 0;
- }
- if (fcntl (ptr_dcc->sock, F_SETFL, O_NONBLOCK) == -1)
- return 0;
+ memset (&addr, 0, sizeof (addr));
+ addr.sin_port = htons (ptr_dcc->port);
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = htonl (ptr_dcc->addr);
+ connect (ptr_dcc->sock, (struct sockaddr *) &addr, sizeof (addr));
+ }
}
return 1;