diff options
author | Timo Sirainen <cras@irssi.org> | 2000-10-26 18:57:23 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-10-26 18:57:23 +0000 |
commit | e0bc134d66fcb1c0a901e82973701e652c2b5cd0 (patch) | |
tree | 6dc20d6c8400b349b41aa2a52a015782103d95a9 /src/core | |
parent | df10f182c019e7cda96793de193e30e66ab2abfc (diff) | |
download | irssi-e0bc134d66fcb1c0a901e82973701e652c2b5cd0.zip |
Win32 updates
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@784 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.c | 4 | ||||
-rw-r--r-- | src/core/net-disconnect.c | 2 | ||||
-rw-r--r-- | src/core/net-nonblock.c | 10 | ||||
-rw-r--r-- | src/core/network.c | 12 |
4 files changed, 26 insertions, 2 deletions
diff --git a/src/core/core.c b/src/core/core.c index a2a928db..ef80f2f5 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -48,7 +48,9 @@ int irssi_gui; void core_init(void) { modules_init(); +#ifndef WIN32 pidwait_init(); +#endif net_disconnect_init(); net_sendbuffer_init(); @@ -96,6 +98,8 @@ void core_deinit(void) net_sendbuffer_deinit(); net_disconnect_deinit(); +#ifndef WIN32 pidwait_deinit(); +#endif modules_deinit(); } diff --git a/src/core/net-disconnect.c b/src/core/net-disconnect.c index 0f604ab3..b5f0212b 100644 --- a/src/core/net-disconnect.c +++ b/src/core/net-disconnect.c @@ -111,6 +111,7 @@ void net_disconnect_init(void) void net_disconnect_deinit(void) { +#ifndef WIN32 NET_DISCONNECT_REC *rec; time_t now, max; int first; @@ -148,4 +149,5 @@ void net_disconnect_deinit(void) first = 0; } } +#endif } diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index d8e85b0a..c6342e08 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -41,10 +41,13 @@ int net_gethostbyname_nonblock(const char *addr, int pipe) { RESOLVED_IP_REC rec; const char *errorstr; +#ifndef WIN32 int pid; +#endif g_return_val_if_fail(addr != NULL, FALSE); +#ifndef WIN32 pid = fork(); if (pid > 0) { /* parent */ @@ -57,6 +60,7 @@ int net_gethostbyname_nonblock(const char *addr, int pipe) g_warning("net_connect_thread(): fork() failed! " "Using blocking resolving"); } +#endif /* child */ memset(&rec, 0, sizeof(rec)); @@ -72,8 +76,10 @@ int net_gethostbyname_nonblock(const char *addr, int pipe) if (rec.error != 0) write(pipe, errorstr, rec.errlen); +#ifndef WIN32 if (pid == 0) _exit(99); +#endif /* we used blocking lookup */ return 0; @@ -89,7 +95,9 @@ int net_gethostbyname_return(int pipe, RESOLVED_IP_REC *rec) rec->errorstr = NULL; /* get ip+error - try for max. 1-2 seconds */ +#ifndef WIN32 fcntl(pipe, F_SETFL, O_NONBLOCK); +#endif maxwait = time(NULL)+2; len = 0; @@ -134,7 +142,9 @@ void net_disconnect_nonblock(int pid) { g_return_if_fail(pid > 0); +#ifndef WIN32 kill(pid, SIGKILL); +#endif } static void simple_init(SIMPLE_THREAD_REC *rec, int handle) diff --git a/src/core/network.c b/src/core/network.c index 8d246bb6..d8a3a38a 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -93,7 +93,7 @@ G_INLINE_FUNC void sin_set_port(union sockaddr_union *so, int port) so->sin6.sin6_port = htons(port); else #endif - so->sin.sin_port = htons(port); + so->sin.sin_port = htons((unsigned short)port); } G_INLINE_FUNC int sin_get_port(union sockaddr_union *so) @@ -133,7 +133,9 @@ int net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip) return -1; /* set socket options */ +#ifndef WIN32 fcntl(handle, F_SETFL, O_NONBLOCK); +#endif setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)); setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, @@ -150,10 +152,12 @@ int net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip) sin_set_port(&so, port); ret = connect(handle, &so.sa, sizeof(so)); +#ifndef WIN32 if (ret < 0 && errno != EINPROGRESS) { close(handle); return -1; } +#endif return handle; } @@ -186,7 +190,9 @@ int net_listen(IPADDR *my_ip, int *port) return -1; /* set socket options */ +#ifndef WIN32 fcntl(handle, F_SETFL, O_NONBLOCK); +#endif setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)); setsockopt(handle, SOL_SOCKET, SO_KEEPALIVE, @@ -235,7 +241,9 @@ int net_accept(int handle, IPADDR *addr, int *port) if (addr != NULL) sin_get_ip(&so, addr); if (port != NULL) *port = sin_get_port(&so); +#ifndef WIN32 fcntl(ret, F_SETFL, O_NONBLOCK); +#endif return ret; } @@ -450,7 +458,7 @@ int net_geterror(int handle) int data; socklen_t len = sizeof(data); - if (getsockopt(handle, SOL_SOCKET, SO_ERROR, &data, &len) == -1) + if (getsockopt(handle, SOL_SOCKET, SO_ERROR, (void *) &data, &len) == -1) return -1; return data; |