mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 12:02:47 -05:00
Prevent network errors from summarily closing the window when CoE is off
[originally from svn r613]
This commit is contained in:
10
telnet.c
10
telnet.c
@ -608,8 +608,11 @@ static int telnet_msg (WPARAM wParam, LPARAM lParam) {
|
||||
if (s == INVALID_SOCKET)
|
||||
return 1;
|
||||
|
||||
if (WSAGETSELECTERROR(lParam) != 0)
|
||||
if (WSAGETSELECTERROR(lParam) != 0) {
|
||||
closesocket(s);
|
||||
s = INVALID_SOCKET;
|
||||
return -WSAGETSELECTERROR(lParam);
|
||||
}
|
||||
|
||||
switch (WSAGETSELECTEVENT(lParam)) {
|
||||
case FD_READ:
|
||||
@ -625,8 +628,11 @@ static int telnet_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;
|
||||
|
Reference in New Issue
Block a user