1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

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.

[originally from svn r5317]
This commit is contained in:
Jacob Nevins 2005-02-16 11:44:44 +00:00
parent c3857f88f7
commit 70de40ba0a

View File

@ -34,7 +34,7 @@ struct Socket_tag {
Plug plug; Plug plug;
void *private_ptr; void *private_ptr;
bufchain output_data; bufchain output_data;
int connected; int connected; /* irrelevant for listening sockets */
int writable; int writable;
int frozen; /* this causes readability notifications to be ignored */ int frozen; /* this causes readability notifications to be ignored */
int frozen_readable; /* this means we missed at least one readability 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->oobpending = FALSE;
ret->listener = 1; ret->listener = 1;
ret->addr = NULL; ret->addr = NULL;
ret->connected = 0;
/* /*
* Translate address_family from platform-independent constants * 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) static void uxsel_tell(Actual_Socket s)
{ {
int rwx = 0; int rwx = 0;
if (!s->connected) if (s->listener) {
rwx |= 2; /* write == connect */ rwx |= 1; /* read == accept */
if (s->connected && !s->frozen) } else {
rwx |= 1 | 4; /* read, except */ if (!s->connected)
if (bufchain_size(&s->output_data)) rwx |= 2; /* write == connect */
rwx |= 2; /* write */ if (s->connected && !s->frozen)
if (s->listener) rwx |= 1 | 4; /* read, except */
rwx |= 1; /* read == accept */ if (bufchain_size(&s->output_data))
rwx |= 2; /* write */
}
uxsel_set(s->s, rwx, net_select_result); uxsel_set(s->s, rwx, net_select_result);
} }