(svn r16601) -Fix [FS#2880]: try 2... hopefully better this time
This commit is contained in:
@@ -50,9 +50,10 @@ public:
|
||||
/**
|
||||
* Close the current connection; for TCP this will be mostly equivalent
|
||||
* to Close(), but for UDP it just means the packet has to be dropped.
|
||||
* @param error Whether we quit under an error condition or not.
|
||||
* @return new status of the connection.
|
||||
*/
|
||||
virtual NetworkRecvStatus CloseConnection() { this->has_quit = true; return NETWORK_RECV_STATUS_OKAY; }
|
||||
virtual NetworkRecvStatus CloseConnection(bool error = true) { this->has_quit = true; return NETWORK_RECV_STATUS_OKAY; }
|
||||
|
||||
/**
|
||||
* Whether the current client connected to the socket has quit.
|
||||
|
@@ -27,10 +27,10 @@ NetworkTCPSocketHandler::~NetworkTCPSocketHandler()
|
||||
this->sock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection()
|
||||
NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection(bool error)
|
||||
{
|
||||
this->writable = false;
|
||||
NetworkSocketHandler::CloseConnection();
|
||||
NetworkSocketHandler::CloseConnection(error);
|
||||
|
||||
/* Free all pending and partially received packets */
|
||||
while (this->packet_queue != NULL) {
|
||||
|
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
bool IsConnected() const { return this->sock != INVALID_SOCKET; }
|
||||
|
||||
virtual NetworkRecvStatus CloseConnection();
|
||||
virtual NetworkRecvStatus CloseConnection(bool error = true);
|
||||
void Send_Packet(Packet *packet);
|
||||
bool Send_Packets();
|
||||
bool IsPacketQueueEmpty();
|
||||
|
@@ -50,7 +50,7 @@ NetworkClientSocket::~NetworkClientSocket()
|
||||
* @return the new status
|
||||
* TODO: needs to be splitted when using client and server socket packets
|
||||
*/
|
||||
NetworkRecvStatus NetworkClientSocket::CloseConnection()
|
||||
NetworkRecvStatus NetworkClientSocket::CloseConnection(bool error)
|
||||
{
|
||||
/* Clients drop back to the main menu */
|
||||
if (!_network_server && _networking) {
|
||||
@@ -62,7 +62,7 @@ NetworkRecvStatus NetworkClientSocket::CloseConnection()
|
||||
return NETWORK_RECV_STATUS_CONN_LOST;
|
||||
}
|
||||
|
||||
NetworkCloseClient(this);
|
||||
NetworkCloseClient(this, error);
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
CommandPacket *command_queue; ///< The command-queue awaiting delivery
|
||||
|
||||
NetworkRecvStatus CloseConnection();
|
||||
NetworkRecvStatus CloseConnection(bool error = true);
|
||||
|
||||
NetworkClientSocket(ClientID client_id = INVALID_CLIENT_ID);
|
||||
~NetworkClientSocket();
|
||||
|
@@ -62,9 +62,9 @@ void NetworkUDPSocketHandler::Close()
|
||||
this->sockets.Clear();
|
||||
}
|
||||
|
||||
NetworkRecvStatus NetworkUDPSocketHandler::CloseConnection()
|
||||
NetworkRecvStatus NetworkUDPSocketHandler::CloseConnection(bool error)
|
||||
{
|
||||
NetworkSocketHandler::CloseConnection();
|
||||
NetworkSocketHandler::CloseConnection(error);
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
||||
|
@@ -110,7 +110,7 @@ protected:
|
||||
/** The opened sockets. */
|
||||
SocketList sockets;
|
||||
|
||||
NetworkRecvStatus CloseConnection();
|
||||
NetworkRecvStatus CloseConnection(bool error = true);
|
||||
|
||||
/* Declare all possible packets here. If it can be received by the
|
||||
* a specific handler, it has to be implemented. */
|
||||
|
Reference in New Issue
Block a user