Loading src/event/iocp.cpp +1 −1 Changes for src/event/iocp.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ namespace netplus { friend class EventWorker; }; event::event(socket *serversocket, int timeout) : _ServerSocket(serversocket) { event::event(netplus::socket *serversocket, int timeout) : _ServerSocket(serversocket) { if (!serversocket) { NetException exp; exp[NetException::Critical] << "server socket empty!"; Loading src/eventapi.h +1 −1 Changes for src/eventapi.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ namespace netplus { class event :public eventapi { public: event(socket *serversocket, int timeout=1000); event(netplus::socket *serversocket, int timeout=1000); void runEventloop(ULONG_PTR args=0); Loading src/posix/socket.cpp −12 Changes for src/posix/socket.cpp: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -50,8 +50,6 @@ #define HIDDEN __attribute__ ((visibility ("hidden"))) std::atomic<int> netplus::socket::_InitCount(0); netplus::socket::socket(){ _SocketInfo=(ULONG_PTR)malloc(sizeof(struct addrinfo)); _SocketInfoLen=sizeof(struct addrinfo); Loading @@ -61,29 +59,19 @@ netplus::socket::socket(){ netplus::socket::~socket(){ int zero = 0; if (_InitCount.compare_exchange_strong(zero, std::memory_order_release)) { if(_SocketInfo){ free(((struct addrinfo*)_SocketInfo)->ai_addr); free((void*)_SocketInfo); } } } void netplus::socket::setFlag(int flag,int value){ int sockopts=fcntl(_Socket, F_GETFL, 0); if (value == 1) { if (fcntl(_Socket, F_SETFL, sockopts | flag) < 0) { NetException exception; exception[NetException::Error] << "Could not set ClientSocket nonblocking!"; throw exception; } }else{ if (fcntl(_Socket, F_SETFL, sockopts & flag) < 0) { NetException exception; exception[NetException::Error] << "Could not set ClientSocket nonblocking!"; throw exception; } } } void netplus::socket::setTimeout(int sec){ Loading src/posix/tcp.cpp +1 −4 Changes for src/posix/tcp.cpp: 1 added line, 4 removed lines. Original line number Diff line number Diff line Loading @@ -117,22 +117,19 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) if (_Socket!=-1) ::close(_Socket); } netplus::tcp::tcp() : socket() { _Socket=-1; _Type=sockettype::TCP; ++_InitCount; } netplus::tcp::tcp(SOCKET sock) : socket (){ ((struct addrinfo*)_SocketInfo)->ai_family=AF_UNSPEC; _Socket=sock; _Type=sockettype::TCP; ++_InitCount; } void netplus::tcp::listen(){ Loading src/posix/udp.cpp +1 −4 Changes for src/posix/udp.cpp: 1 added line, 4 removed lines. Original line number Diff line number Diff line Loading @@ -118,22 +118,19 @@ netplus::udp::udp(const std::string &addr, int port,int maxconnections,int socko netplus::udp::~udp(){ int zero = 0; --_InitCount; if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) if (_Socket!=-1) ::close(_Socket); } netplus::udp::udp() : socket() { _Socket=-1; _Type=sockettype::UDP; ++_InitCount; } netplus::udp::udp(SOCKET sock) : socket(){ ((struct addrinfo*)_SocketInfo)->ai_family=AF_UNSPEC; _Socket=sock; _Type=sockettype::UDP; ++_InitCount; } void netplus::udp::listen(){ Loading Loading
src/event/iocp.cpp +1 −1 Changes for src/event/iocp.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ namespace netplus { friend class EventWorker; }; event::event(socket *serversocket, int timeout) : _ServerSocket(serversocket) { event::event(netplus::socket *serversocket, int timeout) : _ServerSocket(serversocket) { if (!serversocket) { NetException exp; exp[NetException::Critical] << "server socket empty!"; Loading
src/eventapi.h +1 −1 Changes for src/eventapi.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ namespace netplus { class event :public eventapi { public: event(socket *serversocket, int timeout=1000); event(netplus::socket *serversocket, int timeout=1000); void runEventloop(ULONG_PTR args=0); Loading
src/posix/socket.cpp −12 Changes for src/posix/socket.cpp: 0 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -50,8 +50,6 @@ #define HIDDEN __attribute__ ((visibility ("hidden"))) std::atomic<int> netplus::socket::_InitCount(0); netplus::socket::socket(){ _SocketInfo=(ULONG_PTR)malloc(sizeof(struct addrinfo)); _SocketInfoLen=sizeof(struct addrinfo); Loading @@ -61,29 +59,19 @@ netplus::socket::socket(){ netplus::socket::~socket(){ int zero = 0; if (_InitCount.compare_exchange_strong(zero, std::memory_order_release)) { if(_SocketInfo){ free(((struct addrinfo*)_SocketInfo)->ai_addr); free((void*)_SocketInfo); } } } void netplus::socket::setFlag(int flag,int value){ int sockopts=fcntl(_Socket, F_GETFL, 0); if (value == 1) { if (fcntl(_Socket, F_SETFL, sockopts | flag) < 0) { NetException exception; exception[NetException::Error] << "Could not set ClientSocket nonblocking!"; throw exception; } }else{ if (fcntl(_Socket, F_SETFL, sockopts & flag) < 0) { NetException exception; exception[NetException::Error] << "Could not set ClientSocket nonblocking!"; throw exception; } } } void netplus::socket::setTimeout(int sec){ Loading
src/posix/tcp.cpp +1 −4 Changes for src/posix/tcp.cpp: 1 added line, 4 removed lines. Original line number Diff line number Diff line Loading @@ -117,22 +117,19 @@ netplus::tcp::tcp(const std::string &addr, int port,int maxconnections,int socko netplus::tcp::~tcp(){ int zero = 0; --_InitCount; if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) if (_Socket!=-1) ::close(_Socket); } netplus::tcp::tcp() : socket() { _Socket=-1; _Type=sockettype::TCP; ++_InitCount; } netplus::tcp::tcp(SOCKET sock) : socket (){ ((struct addrinfo*)_SocketInfo)->ai_family=AF_UNSPEC; _Socket=sock; _Type=sockettype::TCP; ++_InitCount; } void netplus::tcp::listen(){ Loading
src/posix/udp.cpp +1 −4 Changes for src/posix/udp.cpp: 1 added line, 4 removed lines. Original line number Diff line number Diff line Loading @@ -118,22 +118,19 @@ netplus::udp::udp(const std::string &addr, int port,int maxconnections,int socko netplus::udp::~udp(){ int zero = 0; --_InitCount; if (_Socket!=-1 && _InitCount.compare_exchange_strong(zero, std::memory_order_release)) if (_Socket!=-1) ::close(_Socket); } netplus::udp::udp() : socket() { _Socket=-1; _Type=sockettype::UDP; ++_InitCount; } netplus::udp::udp(SOCKET sock) : socket(){ ((struct addrinfo*)_SocketInfo)->ai_family=AF_UNSPEC; _Socket=sock; _Type=sockettype::UDP; ++_InitCount; } void netplus::udp::listen(){ Loading