1
0
Fork 0

Initialize TCPsocket to nullptr

This typedef originates from SDL_net.h, it's an opaque data type used
for TCP connections.

It's a pointer, therefore prevent copying and assignment in
TCPServerSocket to prevent ownership problems.
This commit is contained in:
Patryk Obara 2020-02-18 21:11:24 +01:00 committed by Patryk Obara
parent 75478a9a39
commit 6468e3c149

View file

@ -95,7 +95,7 @@ private:
Bit8u *nativetcpstruct = nullptr;
#endif
TCPsocket mysock = 0;
TCPsocket mysock = nullptr;
SDLNet_SocketSet listensocketset = nullptr;
// Items for send buffering
@ -106,10 +106,14 @@ private:
struct TCPServerSocket {
bool isopen = false;
TCPsocket mysock = 0;
TCPsocket mysock = nullptr;
TCPServerSocket(Bit16u port);
TCPServerSocket(const TCPServerSocket&) = delete; // prevent copying
TCPServerSocket& operator=(const TCPServerSocket&) = delete; // prevent assignment
~TCPServerSocket();
TCPClientSocket* Accept();
};