wxUsleep is supposed to sleep _milli_seconds, not _micro_seconds.

Got sockets working.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2003-08-07 21:39:40 +00:00
parent f53a0d3287
commit 5c9ee6dd49

View File

@@ -166,15 +166,13 @@ void wxApp::HandleSockets()
int i; int i;
struct GsocketCallbackInfo struct GsocketCallbackInfo
*CallbackInfo = (struct GsocketCallbackInfo *)m_sockCallbackInfo; *CallbackInfo = (struct GsocketCallbackInfo *)m_sockCallbackInfo;
int r = 0;
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 0; timeout.tv_usec = 0;
if ( select(m_maxSocketNr, &readfds, &writefds, 0, &timeout) > 0) if ( select(m_maxSocketNr, &readfds, &writefds, 0, &timeout) > 0)
{ {
for (i = m_lastUsedHandle + 1; i != m_lastUsedHandle; i++) for (i = m_lastUsedHandle + 1; i != m_lastUsedHandle;
(i < m_maxSocketNr - 1) ? i++ : (i = 0))
{ {
if (i == m_maxSocketNr)
i = 0;
if (FD_ISSET(i, &readfds)) if (FD_ISSET(i, &readfds))
{ {
int r; int r;
@@ -187,7 +185,6 @@ void wxApp::HandleSockets()
{ {
CallbackInfo[r].proc(CallbackInfo[r].gsock); CallbackInfo[r].proc(CallbackInfo[r].gsock);
pendingEvent = TRUE; pendingEvent = TRUE;
wxYield();
} }
} }
if (FD_ISSET(i, &writefds)) if (FD_ISSET(i, &writefds))
@@ -201,14 +198,13 @@ void wxApp::HandleSockets()
{ {
CallbackInfo[r].proc(CallbackInfo[r].gsock); CallbackInfo[r].proc(CallbackInfo[r].gsock);
pendingEvent = TRUE; pendingEvent = TRUE;
wxYield();
} }
} }
} }
m_lastUsedHandle = i; m_lastUsedHandle = i;
} }
if (pendingEvent) if (pendingEvent)
wxYield(); ProcessPendingEvents();
} }
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -646,13 +642,13 @@ int wxApp::MainLoop()
while (!Pending() && ProcessIdle()) while (!Pending() && ProcessIdle())
{ {
HandleSockets(); HandleSockets();
wxUsleep(10000); wxUsleep(10);
} }
HandleSockets(); HandleSockets();
if (Pending()) if (Pending())
DoMessage(); DoMessage();
else else
wxUsleep(10000); wxUsleep(10);
} }
return (int)svCurrentMsg.mp1; return (int)svCurrentMsg.mp1;
@@ -869,6 +865,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
if (wxTheApp) if (wxTheApp)
wxTheApp->ProcessPendingEvents(); wxTheApp->ProcessPendingEvents();
HandleSockets();
// //
// Let the logs be flashed again // Let the logs be flashed again
// //