Codechange: use references for UDP packets

This commit is contained in:
Rubidium
2024-02-03 19:43:38 +01:00
committed by rubidium42
parent 031a9d4e26
commit 84623d2123
3 changed files with 27 additions and 27 deletions

View File

@@ -30,23 +30,23 @@ protected:
/** The opened sockets. */
SocketList sockets;
void ReceiveInvalidPacket(PacketUDPType, NetworkAddress *client_addr);
void ReceiveInvalidPacket(PacketUDPType, NetworkAddress &client_addr);
/**
* Queries to the server for information about the game.
* @param p The received packet.
* @param client_addr The origin of the packet.
*/
virtual void Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr);
virtual void Receive_CLIENT_FIND_SERVER(Packet &p, NetworkAddress &client_addr);
/**
* Response to a query letting the client know we are here.
* @param p The received packet.
* @param client_addr The origin of the packet.
*/
virtual void Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr);
virtual void Receive_SERVER_RESPONSE(Packet &p, NetworkAddress &client_addr);
void HandleUDPPacket(Packet *p, NetworkAddress *client_addr);
void HandleUDPPacket(Packet &p, NetworkAddress &client_addr);
public:
NetworkUDPSocketHandler(NetworkAddressList *bind = nullptr);
@@ -56,7 +56,7 @@ public:
bool Listen();
void CloseSocket();
void SendPacket(Packet *p, NetworkAddress *recv, bool all = false, bool broadcast = false);
void SendPacket(Packet &p, NetworkAddress &recv, bool all = false, bool broadcast = false);
void ReceivePackets();
};