From: jacob Date: Wed, 16 Feb 2005 11:44:44 +0000 (+0000) Subject: Simon suggests a better solution to valgrind's complaining about X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/1cfc764f7b2e6d6c68bb2476ee85371783a0db5e Simon suggests a better solution to valgrind's complaining about (struct Socket_tag).connected -- it should be entirely irrelevant to listening sockets. Valgrind is still happy. git-svn-id: svn://svn.tartarus.org/sgt/putty@5317 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/unix/uxnet.c b/unix/uxnet.c index addfc769..c624e0d4 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -34,7 +34,7 @@ struct Socket_tag { Plug plug; void *private_ptr; bufchain output_data; - int connected; + int connected; /* irrelevant for listening sockets */ int writable; int frozen; /* this causes readability notifications to be ignored */ int frozen_readable; /* this means we missed at least one readability @@ -679,7 +679,6 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i ret->oobpending = FALSE; ret->listener = 1; ret->addr = NULL; - ret->connected = 0; /* * Translate address_family from platform-independent constants @@ -1254,14 +1253,16 @@ static void sk_tcp_set_frozen(Socket sock, int is_frozen) static void uxsel_tell(Actual_Socket s) { int rwx = 0; - if (!s->connected) - rwx |= 2; /* write == connect */ - if (s->connected && !s->frozen) - rwx |= 1 | 4; /* read, except */ - if (bufchain_size(&s->output_data)) - rwx |= 2; /* write */ - if (s->listener) - rwx |= 1; /* read == accept */ + if (s->listener) { + rwx |= 1; /* read == accept */ + } else { + if (!s->connected) + rwx |= 2; /* write == connect */ + if (s->connected && !s->frozen) + rwx |= 1 | 4; /* read, except */ + if (bufchain_size(&s->output_data)) + rwx |= 2; /* write */ + } uxsel_set(s->s, rwx, net_select_result); }