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:
parent
75478a9a39
commit
6468e3c149
1 changed files with 6 additions and 2 deletions
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue