1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-15 18:17:32 -05:00

Prevent network errors from summarily closing the window when CoE is off

[originally from svn r613]
This commit is contained in:
Simon Tatham
2000-09-22 11:04:57 +00:00
parent 985207d4a9
commit e5ef37f3f5
7 changed files with 148 additions and 48 deletions

10
raw.c
View File

@ -149,8 +149,11 @@ static int raw_msg (WPARAM wParam, LPARAM lParam) {
* the queue; so it's possible that we can get here even with s
* invalid. If so, we return 1 and don't worry about it.
*/
if (s == INVALID_SOCKET)
if (s == INVALID_SOCKET) {
closesocket(s);
s = INVALID_SOCKET;
return 1;
}
if (WSAGETSELECTERROR(lParam) != 0)
return -WSAGETSELECTERROR(lParam);
@ -161,8 +164,11 @@ static int raw_msg (WPARAM wParam, LPARAM lParam) {
ret = recv(s, buf, sizeof(buf), 0);
if (ret < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
return 1;
if (ret < 0) /* any _other_ error */
if (ret < 0) { /* any _other_ error */
closesocket(s);
s = INVALID_SOCKET;
return -10000-WSAGetLastError();
}
if (ret == 0) {
s = INVALID_SOCKET;
return 0;