mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
When polling MacTCP connections, check the connection state and if the far
end has sent a FIN pass that up to the plug. TODO: handle less graceful connection closures. [originally from svn r2544]
This commit is contained in:
parent
3aec19fa72
commit
cd79a89c11
@ -142,6 +142,19 @@ enum { uppAddrToStrProcInfo = kCStackBased
|
|||||||
|
|
||||||
/* End of AddressXlation.h bits */
|
/* End of AddressXlation.h bits */
|
||||||
|
|
||||||
|
/* TCP connection states, mysteriously missing from <MacTCP.h> */
|
||||||
|
#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_tag {
|
||||||
struct socket_function_table *fn;
|
struct socket_function_table *fn;
|
||||||
/* the above variable absolutely *must* be the first in this structure */
|
/* 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)
|
if (pb.csParam.status.amtUnreadData == 0)
|
||||||
break;
|
break;
|
||||||
mactcp_recv(s, pb.csParam.status.amtUnreadData);
|
mactcp_recv(s, pb.csParam.status.amtUnreadData);
|
||||||
/* Should check connectionState in case remote has closed */
|
|
||||||
} while (TRUE);
|
} 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:
|
next_socket:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user