X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/9bee682602d915c63781de96a588eceb2dc8e4e0..7764212442411b88d673506cae98a271c0bba402:/mac/mtcpnet.c diff --git a/mac/mtcpnet.c b/mac/mtcpnet.c index 60dd84e3..bd630878 100644 --- a/mac/mtcpnet.c +++ b/mac/mtcpnet.c @@ -142,6 +142,19 @@ enum { uppAddrToStrProcInfo = kCStackBased /* End of AddressXlation.h bits */ +/* TCP connection states, mysteriously missing from */ +#define TCPS_CLOSED 0 +#define TCPS_LISTEN 2 +#define TCPS_SYN_RECEIVED 4 +#define TCPS_SYN_SENT 6 +#define TCPS_ESTABLISHED 8 +#define TCPS_FIN_WAIT_1 10 +#define TCPS_FIN_WAIT_2 12 +#define TCPS_CLOSE_WAIT 14 +#define TCPS_CLOSING 16 +#define TCPS_LAST_ACK 18 +#define TCPS_TIME_WAIT 20 + struct Socket_tag { struct socket_function_table *fn; /* the above variable absolutely *must* be the first in this structure */ @@ -606,8 +619,12 @@ void mactcp_poll(void) if (pb.csParam.status.amtUnreadData == 0) break; mactcp_recv(s, pb.csParam.status.amtUnreadData); - /* Should check connectionState in case remote has closed */ } while (TRUE); + switch (pb.csParam.status.connectionState) { + case TCPS_CLOSE_WAIT: + /* Remote end has sent us a FIN */ + plug_closing(s->plug, NULL, 0, 0); + } next_socket: ; }