$OpenBSD: patch-src_ListenSocket_cpp,v 1.2 2011/12/11 18:31:13 dcoppa Exp $

Ok() is just an undocumented alias for IsOk()
(upstream git commit 740c0298147a614806f1676f77a89908074b5574)

Fix: first check our bool variable, then make some calculations if
it's false. Not the other way around
(upstream git commit 41090dfe3756396a8b4496f732ab8493aa51fe6c)

--- src/ListenSocket.cpp.orig	Mon Jun 13 10:50:25 2011
+++ src/ListenSocket.cpp	Fri Dec  9 16:37:45 2011
@@ -57,7 +57,7 @@ CSocketServerProxy(addr, wxSOCKET_NOWAIT|wxSOCKET_REUS
 	totalconnectionchecks = 0;
 	averageconnections = 0.0;
 	// Set the listen socket event handler -- The handler is written in amule.cpp
-	if (Ok()) {
+	if (IsOk()) {
  		SetEventHandler(*theApp, ID_LISTENSOCKET_EVENT);
  		SetNotify(wxSOCKET_CONNECTION_FLAG);
  		Notify(true);
@@ -228,7 +228,8 @@ void CListenSocket::KillAllSockets()
 
 bool CListenSocket::TooManySockets(bool bIgnoreInterval)
 {
-	if (GetOpenSockets() > thePrefs::GetMaxConnections() || (m_OpenSocketsInterval > (thePrefs::GetMaxConperFive()*GetMaxConperFiveModifier()) && !bIgnoreInterval)) {
+	if (GetOpenSockets() > thePrefs::GetMaxConnections()
+		|| (!bIgnoreInterval && m_OpenSocketsInterval > (thePrefs::GetMaxConperFive() * GetMaxConperFiveModifier()))) {
 		return true;
 	} else {
 		return false;
