Fix wxSocket::WaitForAccept() in worker thread.
This was broken because Select() never returned wxSOCKET_CONNECTION_FLAG which is supposed to be set when a connection is accepted. Closes #15669. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -574,6 +574,10 @@ Major new features in this release
|
|||||||
3.0.1: (released 2014-xx-xx)
|
3.0.1: (released 2014-xx-xx)
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
All:
|
||||||
|
|
||||||
|
- Fix wxSocket::WaitForAccept() in non-main thread (Hajo Kirchhoff).
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
- Fix crash when setting invalid label ending with "&" (ZaneUJi).
|
- Fix crash when setting invalid label ending with "&" (ZaneUJi).
|
||||||
|
@@ -1357,7 +1357,25 @@ wxSocketEventFlags wxSocketImpl::Select(wxSocketEventFlags flags,
|
|||||||
|
|
||||||
wxSocketEventFlags detected = 0;
|
wxSocketEventFlags detected = 0;
|
||||||
if ( preadfds && wxFD_ISSET(m_fd, preadfds) )
|
if ( preadfds && wxFD_ISSET(m_fd, preadfds) )
|
||||||
detected |= wxSOCKET_INPUT_FLAG;
|
{
|
||||||
|
// check for the case of a server socket waiting for connection
|
||||||
|
if ( m_server && (flags & wxSOCKET_CONNECTION_FLAG) )
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
SOCKOPTLEN_T len = sizeof(error);
|
||||||
|
m_establishing = false;
|
||||||
|
getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len);
|
||||||
|
|
||||||
|
if ( error )
|
||||||
|
detected = wxSOCKET_LOST_FLAG;
|
||||||
|
else
|
||||||
|
detected |= wxSOCKET_CONNECTION_FLAG;
|
||||||
|
}
|
||||||
|
else // not called to get non-blocking accept() status
|
||||||
|
{
|
||||||
|
detected |= wxSOCKET_INPUT_FLAG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( pwritefds && wxFD_ISSET(m_fd, pwritefds) )
|
if ( pwritefds && wxFD_ISSET(m_fd, pwritefds) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user