mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r17742) -Codechange: remove unused variable from Recv_Packet
This commit is contained in:
parent
65d4612d2a
commit
65f97fb38c
@ -131,13 +131,11 @@ bool NetworkTCPSocketHandler::Send_Packets()
|
|||||||
* @param status the variable to store the status into
|
* @param status the variable to store the status into
|
||||||
* @return the received packet (or NULL when it didn't receive one)
|
* @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;
|
ssize_t res;
|
||||||
Packet *p;
|
Packet *p;
|
||||||
|
|
||||||
*status = NETWORK_RECV_STATUS_OKAY;
|
|
||||||
|
|
||||||
if (!this->IsConnected()) return NULL;
|
if (!this->IsConnected()) return NULL;
|
||||||
|
|
||||||
if (this->packet_recv == NULL) {
|
if (this->packet_recv == NULL) {
|
||||||
@ -157,7 +155,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status)
|
|||||||
if (err != EWOULDBLOCK) {
|
if (err != EWOULDBLOCK) {
|
||||||
/* Something went wrong... (104 is connection reset by peer) */
|
/* Something went wrong... (104 is connection reset by peer) */
|
||||||
if (err != 104) DEBUG(net, 0, "recv failed with error %d", err);
|
if (err != 104) DEBUG(net, 0, "recv failed with error %d", err);
|
||||||
*status = this->CloseConnection();
|
this->CloseConnection();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* Connection would block, so stop for now */
|
/* Connection would block, so stop for now */
|
||||||
@ -165,7 +163,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status)
|
|||||||
}
|
}
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
/* Client/server has left */
|
/* Client/server has left */
|
||||||
*status = this->CloseConnection();
|
this->CloseConnection();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p->pos += res;
|
p->pos += res;
|
||||||
@ -175,7 +173,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status)
|
|||||||
p->ReadRawPacketSize();
|
p->ReadRawPacketSize();
|
||||||
|
|
||||||
if (p->size > SEND_MTU) {
|
if (p->size > SEND_MTU) {
|
||||||
*status = this->CloseConnection();
|
this->CloseConnection();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +186,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status)
|
|||||||
if (err != EWOULDBLOCK) {
|
if (err != EWOULDBLOCK) {
|
||||||
/* Something went wrong... (104 is connection reset by peer) */
|
/* Something went wrong... (104 is connection reset by peer) */
|
||||||
if (err != 104) DEBUG(net, 0, "recv failed with error %d", err);
|
if (err != 104) DEBUG(net, 0, "recv failed with error %d", err);
|
||||||
*status = this->CloseConnection();
|
this->CloseConnection();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* Connection would block */
|
/* Connection would block */
|
||||||
@ -196,7 +194,7 @@ Packet *NetworkTCPSocketHandler::Recv_Packet(NetworkRecvStatus *status)
|
|||||||
}
|
}
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
/* Client/server has left */
|
/* Client/server has left */
|
||||||
*status = this->CloseConnection();
|
this->CloseConnection();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
bool Send_Packets();
|
bool Send_Packets();
|
||||||
bool IsPacketQueueEmpty();
|
bool IsPacketQueueEmpty();
|
||||||
|
|
||||||
Packet *Recv_Packet(NetworkRecvStatus *status);
|
Packet *Recv_Packet();
|
||||||
|
|
||||||
NetworkTCPSocketHandler(SOCKET s = INVALID_SOCKET);
|
NetworkTCPSocketHandler(SOCKET s = INVALID_SOCKET);
|
||||||
~NetworkTCPSocketHandler();
|
~NetworkTCPSocketHandler();
|
||||||
|
@ -105,8 +105,7 @@ bool NetworkContentSocketHandler::HandlePacket(Packet *p)
|
|||||||
void NetworkContentSocketHandler::Recv_Packets()
|
void NetworkContentSocketHandler::Recv_Packets()
|
||||||
{
|
{
|
||||||
Packet *p;
|
Packet *p;
|
||||||
NetworkRecvStatus res;
|
while ((p = this->Recv_Packet()) != NULL) {
|
||||||
while ((p = this->Recv_Packet(&res)) != NULL) {
|
|
||||||
bool cont = HandlePacket(p);
|
bool cont = HandlePacket(p);
|
||||||
delete p;
|
delete p;
|
||||||
if (!cont) return;
|
if (!cont) return;
|
||||||
|
@ -952,7 +952,7 @@ NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientSocket *cs)
|
|||||||
Packet *p;
|
Packet *p;
|
||||||
NetworkRecvStatus res = NETWORK_RECV_STATUS_OKAY;
|
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();
|
byte type = p->Recv_uint8();
|
||||||
if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->HasClientQuit()) {
|
if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->HasClientQuit()) {
|
||||||
res = _network_client_packet[type](p);
|
res = _network_client_packet[type](p);
|
||||||
|
@ -1567,7 +1567,7 @@ void NetworkServer_ReadPackets(NetworkClientSocket *cs)
|
|||||||
{
|
{
|
||||||
Packet *p;
|
Packet *p;
|
||||||
NetworkRecvStatus res;
|
NetworkRecvStatus res;
|
||||||
while ((p = cs->Recv_Packet(&res)) != NULL) {
|
while ((p = cs->Recv_Packet()) != NULL) {
|
||||||
byte type = p->Recv_uint8();
|
byte type = p->Recv_uint8();
|
||||||
if (type < PACKET_END && _network_server_packet[type] != NULL && !cs->HasClientQuit()) {
|
if (type < PACKET_END && _network_server_packet[type] != NULL && !cs->HasClientQuit()) {
|
||||||
res = _network_server_packet[type](cs, p);
|
res = _network_server_packet[type](cs, p);
|
||||||
|
Loading…
Reference in New Issue
Block a user