diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-17 16:18:44 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-17 16:18:44 -0700 |
| commit | 1a0a6755b116214381567804514f01af091e3ca8 (patch) | |
| tree | ecbbdd4b4d764934b2d1f4dfe1c09fb6196b71d4 /node/SocketManager.cpp | |
| parent | 8adbbe092dc9a59d2fa64086b5537e14df3b0210 (diff) | |
| download | infinitytier-1a0a6755b116214381567804514f01af091e3ca8.tar.gz infinitytier-1a0a6755b116214381567804514f01af091e3ca8.zip | |
UDP socket implementation.
Diffstat (limited to 'node/SocketManager.cpp')
| -rw-r--r-- | node/SocketManager.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/node/SocketManager.cpp b/node/SocketManager.cpp index 36def1e1..825d107e 100644 --- a/node/SocketManager.cpp +++ b/node/SocketManager.cpp @@ -434,10 +434,20 @@ void SocketManager::poll(unsigned long timeout) } } for(std::vector< SharedPtr<Socket> >::iterator s(ts.begin());s!=ts.end();++s) { - if (FD_ISSET((*s)->_sock,&rfds)) - (*s)->notifyAvailableForRead(*s,this); - if (FD_ISSET((*s)->_sock,&wfds)) - (*s)->notifyAvailableForWrite(*s,this); + if (FD_ISSET((*s)->_sock,&wfds)) { + if (!(*s)->notifyAvailableForWrite(*s,this)) { + Mutex::Lock _l2(_tcpSockets_m); + _tcpSockets.erase(((TcpSocket *)s->ptr())->_remote); + continue; + } + } + if (FD_ISSET((*s)->_sock,&rfds)) { + if (!(*s)->notifyAvailableForRead(*s,this)) { + Mutex::Lock _l2(_tcpSockets_m); + _tcpSockets.erase(((TcpSocket *)s->ptr())->_remote); + continue; + } + } } } |
