Mercurial > hg > openttd
changeset 13235:43c90fdf90fc draft
(svn r17742) -Codechange: remove unused variable from Recv_Packet
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 07 Oct 2009 20:58:14 +0000 |
parents | 4583d4a14065 |
children | 0d23b42f0504 |
files | src/network/core/tcp.cpp src/network/core/tcp.h src/network/core/tcp_content.cpp src/network/network_client.cpp src/network/network_server.cpp |
diffstat | 5 files changed, 10 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -131,13 +131,11 @@ * @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 @@ 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 @@ } if (res == 0) { /* Client/server has left */ - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } p->pos += res; @@ -175,7 +173,7 @@ p->ReadRawPacketSize(); if (p->size > SEND_MTU) { - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; } } @@ -188,7 +186,7 @@ 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 @@ } if (res == 0) { /* Client/server has left */ - *status = this->CloseConnection(); + this->CloseConnection(); return NULL; }
--- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -41,7 +41,7 @@ bool Send_Packets(); bool IsPacketQueueEmpty(); - Packet *Recv_Packet(NetworkRecvStatus *status); + Packet *Recv_Packet(); NetworkTCPSocketHandler(SOCKET s = INVALID_SOCKET); ~NetworkTCPSocketHandler();
--- a/src/network/core/tcp_content.cpp +++ b/src/network/core/tcp_content.cpp @@ -105,8 +105,7 @@ 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;
--- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -952,7 +952,7 @@ 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);
--- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1567,7 +1567,7 @@ { 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);