X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=winnet.c;h=0dac18e22728269b347fb579f5b4d48a3c3c3cef;hb=9157417feaafc411433f289248f65b0928ee7c06;hp=8e1c2a1ddc743da175305b605b5caf1d73e992fa;hpb=555ded77406b45c6e15cc37bea80fd195bcda9fd;p=PuTTY.git diff --git a/winnet.c b/winnet.c index 8e1c2a1d..0dac18e2 100644 --- a/winnet.c +++ b/winnet.c @@ -124,6 +124,18 @@ void sk_init(void) sktree = newtree234(cmpfortree); } +void sk_cleanup(void) +{ + Actual_Socket s; + int i; + + if (sktree) { + for (i = 0; (s = index234(sktree, i)) != NULL; i++) { + closesocket(s->s); + } + } +} + char *winsock_error_string(int error) { switch (error) { @@ -439,7 +451,7 @@ Socket sk_register(void *sock, Plug plug) } Socket sk_new(SockAddr addr, int port, int privport, int oobinline, - Plug plug) + int nodelay, Plug plug) { static struct socket_function_table fn_table = { sk_tcp_plug, @@ -494,6 +506,11 @@ Socket sk_new(SockAddr addr, int port, int privport, int oobinline, setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (void *) &b, sizeof(b)); } + if (nodelay) { + BOOL b = TRUE; + setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *) &b, sizeof(b)); + } + /* * Bind to local address. */ @@ -964,7 +981,7 @@ int select_result(WPARAM wParam, LPARAM lParam) memset(&isa, 0, sizeof(struct sockaddr_in)); err = 0; - t = accept(s->s,&isa,&addrlen); + t = accept(s->s,(struct sockaddr *)&isa,&addrlen); if (t == INVALID_SOCKET) { err = WSAGetLastError();