let's see it it works now...
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -635,8 +635,7 @@ void wxSocketBase::RestoreState()
|
|||||||
//
|
//
|
||||||
// XXX: Should it honour the wxSOCKET_BLOCK flag ?
|
// XXX: Should it honour the wxSOCKET_BLOCK flag ?
|
||||||
//
|
//
|
||||||
bool wxSocketBase::_Wait(long seconds,
|
bool wxSocketBase::_Wait(long seconds, long milliseconds,
|
||||||
long milliseconds,
|
|
||||||
wxSocketEventFlags flags)
|
wxSocketEventFlags flags)
|
||||||
{
|
{
|
||||||
GSocketEventFlags result;
|
GSocketEventFlags result;
|
||||||
@@ -684,11 +683,6 @@ bool wxSocketBase::_Wait(long seconds,
|
|||||||
{
|
{
|
||||||
result = GSocket_Select(m_socket, flags | GSOCK_LOST_FLAG);
|
result = GSocket_Select(m_socket, flags | GSOCK_LOST_FLAG);
|
||||||
|
|
||||||
// The order in which we check events is important; in particular,
|
|
||||||
// GSOCKET_LOST events should be checked last (there might be still
|
|
||||||
// data to read in the incoming queue even after the peer has closed
|
|
||||||
// the connection).
|
|
||||||
|
|
||||||
// Incoming connection (server) or connection established (client)
|
// Incoming connection (server) or connection established (client)
|
||||||
if (result & GSOCK_CONNECTION_FLAG)
|
if (result & GSOCK_CONNECTION_FLAG)
|
||||||
{
|
{
|
||||||
@@ -698,7 +692,6 @@ bool wxSocketBase::_Wait(long seconds,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input and output
|
|
||||||
if ((result & GSOCK_INPUT_FLAG) || (result & GSOCK_OUTPUT_FLAG))
|
if ((result & GSOCK_INPUT_FLAG) || (result & GSOCK_OUTPUT_FLAG))
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
@@ -709,8 +702,7 @@ bool wxSocketBase::_Wait(long seconds,
|
|||||||
if (result & GSOCK_LOST_FLAG)
|
if (result & GSOCK_LOST_FLAG)
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
Close();
|
return TRUE; // XXX: should be FALSE if !(flags & GSOCK_LOST_FLAG) !
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait more?
|
// Wait more?
|
||||||
@@ -833,42 +825,29 @@ void wxSocketBase::OnRequest(wxSocketNotify req_evt)
|
|||||||
|
|
||||||
// dbg("Entering OnRequest (evt %d)\n", req_evt);
|
// dbg("Entering OnRequest (evt %d)\n", req_evt);
|
||||||
|
|
||||||
switch (req_evt)
|
// This duplicates some code in _Wait(), but this doesn't
|
||||||
|
// hurt. It has to be here because we don't know whether
|
||||||
|
// WaitXXX will be used, and it has to be in _Wait as well
|
||||||
|
// because the event might be a bit delayed.
|
||||||
|
//
|
||||||
|
if (req_evt == wxSOCKET_CONNECTION)
|
||||||
|
{
|
||||||
|
m_establishing = FALSE;
|
||||||
|
m_connected = TRUE;
|
||||||
|
}
|
||||||
|
else if (req_evt == wxSOCKET_INPUT)
|
||||||
{
|
{
|
||||||
// This duplicates some code in _Wait(), but this doesn't hurt.
|
|
||||||
// It has to be here because we don't know whether the Wait()
|
|
||||||
// functions will be used, and it has to be in _Wait as well
|
|
||||||
// because the event might be a bit delayed.
|
|
||||||
//
|
|
||||||
// The order in which we check events is important; in particular,
|
|
||||||
// GSOCKET_LOST events should be checked last (there might be still
|
|
||||||
// data to read in the incoming queue even after the peer has
|
|
||||||
// closed the connection).
|
|
||||||
|
|
||||||
case wxSOCKET_CONNECTION :
|
|
||||||
m_establishing = FALSE;
|
|
||||||
m_connected = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// If we are in the middle of a R/W operation, do not
|
// If we are in the middle of a R/W operation, do not
|
||||||
// propagate events to users. Also, filter 'late' events
|
// propagate events to users. Also, filter 'late' events
|
||||||
// which are no longer valid.
|
// which are no longer valid.
|
||||||
//
|
//
|
||||||
case wxSOCKET_INPUT:
|
if (m_reading || !GSocket_Select(m_socket, GSOCK_INPUT_FLAG))
|
||||||
if (m_reading || !GSocket_Select(m_socket, GSOCK_INPUT_FLAG))
|
return;
|
||||||
return;
|
}
|
||||||
else
|
else if (req_evt == wxSOCKET_OUTPUT)
|
||||||
break;
|
{
|
||||||
|
if (m_writing || !GSocket_Select(m_socket, GSOCK_OUTPUT_FLAG))
|
||||||
case wxSOCKET_OUTPUT:
|
return;
|
||||||
if (m_writing || !GSocket_Select(m_socket, GSOCK_OUTPUT_FLAG))
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxSOCKET_LOST:
|
|
||||||
Close();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((m_neededreq & flag) == flag) && m_notify_state)
|
if (((m_neededreq & flag) == flag) && m_notify_state)
|
||||||
@@ -1078,7 +1057,6 @@ bool wxSocketClient::Connect(wxSockAddress& addr_man, bool wait)
|
|||||||
if (IsConnected())
|
if (IsConnected())
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
// This should never happen.
|
|
||||||
if (m_socket)
|
if (m_socket)
|
||||||
GSocket_destroy(m_socket);
|
GSocket_destroy(m_socket);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user