mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add checks for clean disconnect in HTTP/TCP/SSL.
Half-open TCP connection can, of course, only be detected by writing the socket, or waiting for TCP timeout.
This commit is contained in:
parent
561a7772c6
commit
92de6df113
4 changed files with 66 additions and 3 deletions
|
@ -375,6 +375,18 @@ Error HTTPClient::poll() {
|
|||
}
|
||||
} break;
|
||||
case STATUS_CONNECTED: {
|
||||
// Check if we are still connected
|
||||
if (ssl) {
|
||||
Ref<StreamPeerSSL> tmp = connection;
|
||||
tmp->poll();
|
||||
if (tmp->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
|
||||
status = STATUS_CONNECTION_ERROR;
|
||||
return ERR_CONNECTION_ERROR;
|
||||
}
|
||||
} else if (tcp_connection->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
|
||||
status = STATUS_CONNECTION_ERROR;
|
||||
return ERR_CONNECTION_ERROR;
|
||||
}
|
||||
// Connection established, requests can now be made
|
||||
return OK;
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue