Never use events for blocking sockets under Unix.
Events are not needed for this kind of sockets, using wxSOCKET_BLOCK is supposed to ensure that calling socket IO operations blocks until the bytes are read/written without dispatching any events. See #17031.
This commit is contained in:
@@ -308,6 +308,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxSocketImpl(wxSocketBase& wxsocket);
|
wxSocketImpl(wxSocketBase& wxsocket);
|
||||||
|
|
||||||
|
// get the associated socket flags
|
||||||
|
wxSocketFlags GetSocketFlags() const { return m_wxsocket->GetFlags(); }
|
||||||
|
|
||||||
// true if we're a listening stream socket
|
// true if we're a listening stream socket
|
||||||
bool m_server;
|
bool m_server;
|
||||||
|
|
||||||
|
@@ -90,6 +90,11 @@ wxSocketError wxSocketImplUnix::GetLastError() const
|
|||||||
|
|
||||||
void wxSocketImplUnix::DoEnableEvents(int flags, bool enable)
|
void wxSocketImplUnix::DoEnableEvents(int flags, bool enable)
|
||||||
{
|
{
|
||||||
|
// No events for blocking sockets, they should be usable from the other
|
||||||
|
// threads and the events only work for the sockets used by the main one.
|
||||||
|
if ( GetSocketFlags() & wxSOCKET_BLOCK )
|
||||||
|
return;
|
||||||
|
|
||||||
wxSocketManager * const manager = wxSocketManager::Get();
|
wxSocketManager * const manager = wxSocketManager::Get();
|
||||||
if (!manager)
|
if (!manager)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user