OpenTTD Source
20241121-master-g67a0fccfad
|
SocketHandler for all network sockets in OpenTTD. More...
#include <core.h>
Public Member Functions | |
NetworkSocketHandler () | |
Create a new unbound socket. | |
virtual | ~NetworkSocketHandler ()=default |
Close the socket when destructing the socket handler. | |
void | MarkClosed () |
Mark the connection as closed. More... | |
bool | HasClientQuit () const |
Whether the current client connected to the socket has quit. More... | |
void | Reopen () |
Reopen the socket so we can send/receive stuff again. | |
Protected Attributes | |
std::unique_ptr< class NetworkEncryptionHandler > | receive_encryption_handler |
The handler for decrypting received packets. | |
std::unique_ptr< class NetworkEncryptionHandler > | send_encryption_handler |
The handler for encrypting sent packets. | |
Private Attributes | |
bool | has_quit |
Whether the current client has quit/send a bad packet. | |
Friends | |
struct | Packet |
|
inline |
Whether the current client connected to the socket has quit.
In the case of UDP, for example, once a client quits (send bad data), the socket in not closed; only the packet is dropped.
Definition at line 74 of file core.h.
References has_quit.
Referenced by Packet::CanReadFromPacket(), ClientNetworkGameSocketHandler::CloseConnection(), ServerNetworkGameSocketHandler::CloseConnection(), NetworkAdminSocketHandler::HandlePacket(), NetworkContentSocketHandler::HandlePacket(), NetworkGameSocketHandler::HandlePacket(), NetworkUDPSocketHandler::HandleUDPPacket(), ServerNetworkGameSocketHandler::Receive_CLIENT_COMMAND(), ServerNetworkGameSocketHandler::Receive_CLIENT_ERROR(), ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(), ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(), and ServerNetworkGameSocketHandler::Receive_CLIENT_QUIT().
|
inline |
Mark the connection as closed.
This doesn't mean the actual connection is closed, but just that we act like it is. This is useful for UDP, which doesn't normally close a socket, but its handler might need to pretend it does.
Definition at line 66 of file core.h.
Referenced by ClientNetworkGameSocketHandler::ClientError(), and NetworkTCPSocketHandler::CloseConnection().