Loading src/event/epoll.cpp +3 −8 Changes for src/event/epoll.cpp: 3 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -108,19 +108,14 @@ namespace netplus { _Timeout(timeout) { int maxcon=_ServerSocket->getMaxconnections(); NetException exception; for (int i = 0; i <maxcon; ++i){ for (int i = 0; i <_ServerSocket->getMaxconnections(); ++i){ _Events[i].events=-1; _Events[i].data.fd=-1; _Events[i].data.ptr=nullptr; } }; ~poll() { virtual ~poll() { }; /*basic functions*/ Loading Loading @@ -308,7 +303,7 @@ namespace netplus { int _pollFD; std::unique_ptr<struct epoll_event[]> _Events; std::unique_ptr<socket> _ServerSocket; socket* _ServerSocket; int _Timeout; }; Loading src/posix/socket.cpp +2 −1 Changes for src/posix/socket.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ netplus::socket::socket(){ } netplus::socket::~socket(){ if(_InitCount==0){ int zero = 0; if (_InitCount.compare_exchange_strong(zero, std::memory_order_release)) { if(_SocketInfo){ free(((struct addrinfo*)_SocketInfo)->ai_addr); free((void*)_SocketInfo); Loading src/posix/tcp.cpp +3 −1 Changes for src/posix/tcp.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -116,14 +116,16 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko } netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } netplus::tcp::tcp() : socket() { _Socket=-1; _Type=sockettype::TCP; ++_InitCount; } netplus::tcp::tcp(SOCKET sock) : socket (){ Loading src/posix/udp.cpp +2 −1 Changes for src/posix/udp.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -117,8 +117,9 @@ netplus::udp::udp(const std::string &addr, int port,int maxconnections,int socko } netplus::udp::~udp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } Loading src/windows/tcp.cpp +3 −2 Changes for src/windows/tcp.cpp: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -93,9 +93,10 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko } netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) ::closesocket(_Socket); if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } netplus::tcp::tcp() : socket() { Loading Loading
src/event/epoll.cpp +3 −8 Changes for src/event/epoll.cpp: 3 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -108,19 +108,14 @@ namespace netplus { _Timeout(timeout) { int maxcon=_ServerSocket->getMaxconnections(); NetException exception; for (int i = 0; i <maxcon; ++i){ for (int i = 0; i <_ServerSocket->getMaxconnections(); ++i){ _Events[i].events=-1; _Events[i].data.fd=-1; _Events[i].data.ptr=nullptr; } }; ~poll() { virtual ~poll() { }; /*basic functions*/ Loading Loading @@ -308,7 +303,7 @@ namespace netplus { int _pollFD; std::unique_ptr<struct epoll_event[]> _Events; std::unique_ptr<socket> _ServerSocket; socket* _ServerSocket; int _Timeout; }; Loading
src/posix/socket.cpp +2 −1 Changes for src/posix/socket.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -60,7 +60,8 @@ netplus::socket::socket(){ } netplus::socket::~socket(){ if(_InitCount==0){ int zero = 0; if (_InitCount.compare_exchange_strong(zero, std::memory_order_release)) { if(_SocketInfo){ free(((struct addrinfo*)_SocketInfo)->ai_addr); free((void*)_SocketInfo); Loading
src/posix/tcp.cpp +3 −1 Changes for src/posix/tcp.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -116,14 +116,16 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko } netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } netplus::tcp::tcp() : socket() { _Socket=-1; _Type=sockettype::TCP; ++_InitCount; } netplus::tcp::tcp(SOCKET sock) : socket (){ Loading
src/posix/udp.cpp +2 −1 Changes for src/posix/udp.cpp: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -117,8 +117,9 @@ netplus::udp::udp(const std::string &addr, int port,int maxconnections,int socko } netplus::udp::~udp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } Loading
src/windows/tcp.cpp +3 −2 Changes for src/windows/tcp.cpp: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -93,9 +93,10 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko } netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if(_Socket!=-1 && _InitCount <=0) ::closesocket(_Socket); if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) ::close(_Socket); } netplus::tcp::tcp() : socket() { Loading