mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 14:02:47 -05:00
Introduce an enum of the uxsel / select_result flags.
Those magic numbers 1,2,4 were getting annoying. Time to replace them while I can still remember what they do.
This commit is contained in:
14
unix/uxnet.c
14
unix/uxnet.c
@ -1283,7 +1283,7 @@ static void net_select_result(int fd, int event)
|
||||
noise_ultralight(NOISE_SOURCE_IOID, fd);
|
||||
|
||||
switch (event) {
|
||||
case 4: /* exceptional */
|
||||
case SELECT_X: /* exceptional */
|
||||
if (!s->oobinline) {
|
||||
/*
|
||||
* On a non-oobinline socket, this indicates that we
|
||||
@ -1320,7 +1320,7 @@ static void net_select_result(int fd, int event)
|
||||
*/
|
||||
s->oobpending = true;
|
||||
break;
|
||||
case 1: /* readable; also acceptance */
|
||||
case SELECT_R: /* readable; also acceptance */
|
||||
if (s->listener) {
|
||||
/*
|
||||
* On a listening socket, the readability event means a
|
||||
@ -1400,7 +1400,7 @@ static void net_select_result(int fd, int event)
|
||||
plug_receive(s->plug, atmark ? 0 : 1, buf, ret);
|
||||
}
|
||||
break;
|
||||
case 2: /* writable */
|
||||
case SELECT_W: /* writable */
|
||||
if (!s->connected) {
|
||||
/*
|
||||
* select() reports a socket as _writable_ when an
|
||||
@ -1559,14 +1559,14 @@ static void uxsel_tell(NetSocket *s)
|
||||
int rwx = 0;
|
||||
if (!s->pending_error) {
|
||||
if (s->listener) {
|
||||
rwx |= 1; /* read == accept */
|
||||
rwx |= SELECT_R; /* read == accept */
|
||||
} else {
|
||||
if (!s->connected)
|
||||
rwx |= 2; /* write == connect */
|
||||
rwx |= SELECT_W; /* write == connect */
|
||||
if (s->connected && !s->frozen && !s->incomingeof)
|
||||
rwx |= 1 | 4; /* read, except */
|
||||
rwx |= SELECT_R | SELECT_X;
|
||||
if (bufchain_size(&s->output_data))
|
||||
rwx |= 2; /* write */
|
||||
rwx |= SELECT_W;
|
||||
}
|
||||
}
|
||||
uxsel_set(s->s, rwx, net_select_result);
|
||||
|
Reference in New Issue
Block a user