diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-19 22:01:32 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-19 22:01:32 -0700 |
| commit | 15e8c181063ecd32b2dc2eec9185d976005e0c43 (patch) | |
| tree | 316ee89e9a21e920293addc0291618a3da1c247b /node/SocketManager.hpp | |
| parent | 1c555e4b9652e9a5a8a6251f2cb7f76c568c069d (diff) | |
| download | infinitytier-15e8c181063ecd32b2dc2eec9185d976005e0c43.tar.gz infinitytier-15e8c181063ecd32b2dc2eec9185d976005e0c43.zip | |
Bug fixes.
Diffstat (limited to 'node/SocketManager.hpp')
| -rw-r--r-- | node/SocketManager.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/node/SocketManager.hpp b/node/SocketManager.hpp index 9f980e37..e6e87a1f 100644 --- a/node/SocketManager.hpp +++ b/node/SocketManager.hpp @@ -169,6 +169,27 @@ private: #endif } + inline void _updateNfds() + { + int nfds = _whackSendPipe; + if (_whackReceivePipe > nfds) + nfds = _whackReceivePipe; + if (_tcpV4ListenSocket > nfds) + nfds = _tcpV4ListenSocket; + if (_tcpV6ListenSocket > nfds) + nfds = _tcpV6ListenSocket; + if ((_udpV4Socket)&&(_udpV4Socket->_sock > nfds)) + nfds = _udpV4Socket->_sock; + if ((_udpV6Socket)&&(_udpV6Socket->_sock > nfds)) + nfds = _udpV6Socket->_sock; + Mutex::Lock _l(_tcpSockets_m); + for(std::map< InetAddress,SharedPtr<Socket> >::const_iterator s(_tcpSockets.begin());s!=_tcpSockets.end();++s) { + if (s->second->_sock > nfds) + nfds = s->second->_sock; + } + _nfds = nfds; + } + #ifdef __WINDOWS__ SOCKET _whackSendPipe; SOCKET _whackReceivePipe; @@ -187,7 +208,7 @@ private: fd_set _readfds; fd_set _writefds; - int _nfds; + volatile int _nfds; Mutex _fdSetLock; std::map< InetAddress,SharedPtr<Socket> > _tcpSockets; |
