summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/core/tcp.cpp14
-rw-r--r--src/network/core/tcp.h2
-rw-r--r--src/network/core/tcp_content.cpp3
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_server.cpp2
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);