You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user