[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: small patch
Il giorno mar, 01/08/2006 alle 09.57 -0400, Nick Mathewson ha scritto:
> On Tue, Aug 01, 2006 at 08:09:28AM +0100, freddyz77@xxxxxx wrote:
> > Hi,
> > this is just a small patch to reuse code and close correctly
> > socket on windows.
> >
> > freddy77
>
> Hi Freddy, and thanks for the patch! It looks like you missed the
> comment at the head of the eventdns.c file:
>
> // Try to keep this re-mergeable by Adam. Don't make it depend on Tor.
>
> In other words, we'd like eventdns.c to be useable by others in the
> long term, so that we don't need to maintain it forever. In practice,
> this means we can't add any dependencies to the rest of Tor there.
>
So, here you are an updated patch
Frediano
Index: src/or/eventdns.c
===================================================================
--- src/or/eventdns.c (revisione 6964)
+++ src/or/eventdns.c (copia locale)
@@ -1186,8 +1186,8 @@
if (ns->socket < 0) { err = 1; goto out1; }
#ifdef MS_WINDOWS
{
- int nonblocking = 1;
- ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
+ u_long nonblocking = 1;
+ ioctlsocket(ns->socket, FIONBIO, &nonblocking);
}
#else
fcntl(ns->socket, F_SETFL, O_NONBLOCK);
@@ -1223,7 +1223,11 @@
return 0;
out2:
+#ifdef MS_WINDOWS
+ closesocket(ns->socket);
+#else
close(ns->socket);
+#endif
out1:
free(ns);
return err;