diff options
author | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-15 20:41:30 +0000 |
---|---|---|
committer | burlex <burlex@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-08-15 20:41:30 +0000 |
commit | 8cebdce0933438c32fc5821dd16d090ea06fd8cc (patch) | |
tree | 505df2bb898fad59ebd2dfef0a61698c4765c973 /src | |
parent | bb35a0fa9cbebe51fa636f707c12ca4a7033dd9a (diff) |
* include/caller.h will now compile correctly on Windows platforms.
+ Implemented gettimeofday in win32 wrapper, link rtt's will now display in milliseconds.
* SocketEngine::BoundsCheckFd will now handle Windows event handler cases correctly. (fixing writing to sockets not working)
* Fixed VC71 project.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7723 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 4 | ||||
-rw-r--r-- | src/socketengine.cpp | 14 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index ed54be0fb..3d472bf7a 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -174,12 +174,7 @@ std::string ModuleSpanningTree::TimeToStr(time_t secs) const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current) { time_t secs_up = ServerInstance->Time() - Current->age; - -#ifndef WIN32 return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"ms]"); -#else - return (" [Up: " + TimeToStr(secs_up) + " Lag: "+ConvToStr(Current->rtt)+"s]"); -#endif } // WARNING: NOT THREAD SAFE - DONT GET ANY SMART IDEAS. @@ -492,12 +487,10 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime) sock->WriteLine(std::string(":")+ServerInstance->Config->ServerName+" PING "+serv->GetName()); serv->SetNextPingTime(curtime + Utils->PingFreq); serv->LastPing = curtime; -#ifndef WIN32 timeval t; gettimeofday(&t, NULL); long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000); serv->LastPingMsec = ts; -#endif serv->Warned = false; } else diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 527c0122b..88c7666bf 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -365,14 +365,10 @@ bool TreeSocket::LocalPong(const std::string &prefix, std::deque<std::string> &p if (ServerSource) { ServerSource->SetPingFlag(); -#ifndef WIN32 timeval t; gettimeofday(&t, NULL); long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000); ServerSource->rtt = ts - ServerSource->LastPingMsec; -#else - ServerSource->rtt = Instance->Time() - ServerSource->LastPing; -#endif } } else diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 28ba8c252..3aef464e6 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -93,10 +93,24 @@ std::string SocketEngine::GetName() bool SocketEngine::BoundsCheckFd(EventHandler* eh) { +#ifdef WINDOWS + int * internal_fd; + if(!eh || eh->GetFd() < 0) + return false; + + if(!eh->GetExt("internal_fd", internal_fd)) + return false; + + if(*internal_fd > MAX_DESCRIPTORS) + return false; + + return true; +#else if (!eh) return false; if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS)) return false; return true; +#endif } |