summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-06-19 20:26:18 +0000
committerrubidium <rubidium@openttd.org>2009-06-19 20:26:18 +0000
commit9b156c1bd433fd231868a70dad719c6972858072 (patch)
treef60f2169c27f97bee6ccd6f37ce4fc4bc25702ef /src/network/core
parent83f8d52a6770634f503282e4c9407a54f1825255 (diff)
downloadopenttd-9b156c1bd433fd231868a70dad719c6972858072.tar.xz
(svn r16601) -Fix [FS#2880]: try 2... hopefully better this time
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/core.h3
-rw-r--r--src/network/core/tcp.cpp4
-rw-r--r--src/network/core/tcp.h2
-rw-r--r--src/network/core/tcp_game.cpp4
-rw-r--r--src/network/core/tcp_game.h2
-rw-r--r--src/network/core/udp.cpp4
-rw-r--r--src/network/core/udp.h2
7 files changed, 11 insertions, 10 deletions
diff --git a/src/network/core/core.h b/src/network/core/core.h
index 4fca89f54..89c316402 100644
--- a/src/network/core/core.h
+++ b/src/network/core/core.h
@@ -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.
diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp
index a80defb4c..dd79edbb5 100644
--- a/src/network/core/tcp.cpp
+++ b/src/network/core/tcp.cpp
@@ -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) {
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index 7e4964813..1ced4bd6e 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -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();
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index b4bb52190..58447ad68 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -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;
}
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index 1d29b5a02..69412fcd2 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -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();
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index fec5bfb59..9dbf8dea4 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -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;
}
diff --git a/src/network/core/udp.h b/src/network/core/udp.h
index 6f68c213d..226cbb0df 100644
--- a/src/network/core/udp.h
+++ b/src/network/core/udp.h
@@ -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. */