Modem: shutdown local socket when remote is shutdown

Fixes issues with http requests: web browsers, Monaco Grand Prix Online
This commit is contained in:
Flyinghead 2018-09-26 00:04:57 +02:00
parent c135ab0e90
commit 3ff14dd2b3
1 changed files with 4 additions and 1 deletions

View File

@ -461,13 +461,16 @@ static void read_native_sockets()
// FIXME EAGAIN errors. Need to buffer data or wait for call back.
printf("%s: truncated send: %d -> %d\n", __FUNCTION__, r, r2);
}
else if (r == 0)
{
pico_socket_shutdown(it->first, PICO_SHUT_RDWR);
}
else if (r < 0 && get_last_error() != L_EAGAIN && get_last_error() != L_EWOULDBLOCK)
{
perror("recv tcp socket");
closesocket(it->second);
pico_socket_close(it->first);
tcp_sockets.erase(it);
continue;
}
}
}