diff options
author | rubidium <rubidium@openttd.org> | 2009-10-07 20:58:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-10-07 20:58:14 +0000 |
commit | df75db67ebe271e9de92cc65872ff65b46e4ad4a (patch) | |
tree | 48f73cf744b9a0656a9dd23a8a6bab9608fa2a7d /src/network | |
parent | 8c37da1be680852d5429da8d5519fa3f799575e3 (diff) | |
download | openttd-df75db67ebe271e9de92cc65872ff65b46e4ad4a.tar.xz |
(svn r17742) -Codechange: remove unused variable from Recv_Packet
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/core/tcp.cpp | 14 | ||||
-rw-r--r-- | src/network/core/tcp.h | 2 | ||||
-rw-r--r-- | src/network/core/tcp_content.cpp | 3 | ||||
-rw-r--r-- | src/network/network_client.cpp | 2 | ||||
-rw-r--r-- | src/network/network_server.cpp | 2 |
5 files changed, 10 insertions, 13 deletions
diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp index 2064945a7..b30e4e526 100644 --- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -131,13 +131,11 @@ bool NetworkTCPSocketHandler::Send_Packets() * @param status the variable to store the status into * @return the received packet (or NULL when it didn't receive one) */ -Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) +Packet *NetworkTCPSocketHandler::Recv_Packet() { ssize_t res; Packet *p; - *status = NETWORK_RECV_STATUS_OKAY; - if (!this->IsConnected()) return NULL; if (this->packet_recv == NULL) { @@ -157,7 +155,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) if (err != EWOULDBLOCK) { /* Something went wrong... (104 is connection reset by peer) */ if (err != 104) DEBUG(net, 0, "recv failed with error %d", err); - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } /* Connection would block, so stop for now */ @@ -165,7 +163,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) } if (res == 0) { /* Client/server has left */ - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } p->pos += res; @@ -175,7 +173,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) p->ReadRawPacketSize(); if (p->size > SEND_MTU) { - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } } @@ -188,7 +186,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) if (err != EWOULDBLOCK) { /* Something went wrong... (104 is connection reset by peer) */ if (err != 104) DEBUG(net, 0, "recv failed with error %d", err); - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } /* Connection would block */ @@ -196,7 +194,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status) } if (res == 0) { /* Client/server has left */ - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index c368339ef..904db99c4 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -41,7 +41,7 @@ public: bool Send_Packets(); bool IsPacketQueueEmpty(); - Packet *Recv_Packet(NetworkRecvStatus *status); + Packet *Recv_Packet(); NetworkTCPSocketHandler(SOCKET s = INVALID_SOCKET); ~NetworkTCPSocketHandler(); diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp index 423516f2e..3c999c4dc 100644 --- a/src/network/core/tcp_content.cpp +++ b/src/network/core/tcp_content.cpp @@ -105,8 +105,7 @@ bool NetworkContentSocketHandler::HandlePacket(Packet *p) void NetworkContentSocketHandler::Recv_Packets() { Packet *p; - NetworkRecvStatus res; - while ((p = this->Recv_Packet(&res)) != NULL) { + while ((p = this->Recv_Packet()) != NULL) { bool cont = HandlePacket(p); delete p; if (!cont) return; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 95b34ef1b..97bd2baaa 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -952,7 +952,7 @@ NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientSocket *cs) Packet *p; NetworkRecvStatus res = NETWORK_RECV_STATUS_OKAY; - while (res == NETWORK_RECV_STATUS_OKAY && (p = cs->Recv_Packet(&res)) != NULL) { + while (res == NETWORK_RECV_STATUS_OKAY && (p = cs->Recv_Packet()) != NULL) { byte type = p->Recv_uint8(); if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->HasClientQuit()) { res = _network_client_packet[type](p); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 86f4739be..bea3c558a 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1567,7 +1567,7 @@ void NetworkServer_ReadPackets(NetworkClientSocket *cs) { Packet *p; NetworkRecvStatus res; - while ((p = cs->Recv_Packet(&res)) != NULL) { + while ((p = cs->Recv_Packet()) != NULL) { byte type = p->Recv_uint8(); if (type < PACKET_END && _network_server_packet[type] != NULL && !cs->HasClientQuit()) { res = _network_server_packet[type](cs, p); |