don't close UDP socket if it receives an empty datagram (patch 1885472)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -121,6 +121,7 @@ All (Unix):
|
|||||||
- Fixed shared libraries to not depend on GStreamer when built with
|
- Fixed shared libraries to not depend on GStreamer when built with
|
||||||
--enable-media; only wxMedia library depends on it now.
|
--enable-media; only wxMedia library depends on it now.
|
||||||
- wxLaunchDefaultBrowser() now uses xdg-open if available.
|
- wxLaunchDefaultBrowser() now uses xdg-open if available.
|
||||||
|
- Don't close UDP socket if an empty datagram is received (Mikkel S)
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -1175,11 +1175,16 @@ int GSocket::Read(char *buffer, int size)
|
|||||||
else
|
else
|
||||||
ret = Recv_Dgram(buffer, size);
|
ret = Recv_Dgram(buffer, size);
|
||||||
|
|
||||||
/* If recv returned zero, then the connection has been gracefully closed.
|
/*
|
||||||
* Otherwise, recv has returned an error (-1), in which case we have lost the
|
* If recv returned zero for a TCP socket (if m_stream == NULL, it's an UDP
|
||||||
* socket only if errno does _not_ indicate that there may be more data to read.
|
* socket and empty datagrams are possible), then the connection has been
|
||||||
|
* gracefully closed.
|
||||||
|
*
|
||||||
|
* Otherwise, recv has returned an error (-1), in which case we have lost
|
||||||
|
* the socket only if errno does _not_ indicate that there may be more data
|
||||||
|
* to read.
|
||||||
*/
|
*/
|
||||||
if (ret == 0)
|
if ((ret == 0) && m_stream)
|
||||||
{
|
{
|
||||||
/* Make sure wxSOCKET_LOST event gets sent and shut down the socket */
|
/* Make sure wxSOCKET_LOST event gets sent and shut down the socket */
|
||||||
m_detected = GSOCK_LOST_FLAG;
|
m_detected = GSOCK_LOST_FLAG;
|
||||||
@@ -1760,9 +1765,17 @@ void GSocket::Detected_Read()
|
|||||||
}
|
}
|
||||||
else if (num == 0)
|
else if (num == 0)
|
||||||
{
|
{
|
||||||
/* graceful shutdown */
|
if (m_stream)
|
||||||
CALL_CALLBACK(this, GSOCK_LOST);
|
{
|
||||||
Shutdown();
|
/* graceful shutdown */
|
||||||
|
CALL_CALLBACK(this, GSOCK_LOST);
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Empty datagram received */
|
||||||
|
CALL_CALLBACK(this, GSOCK_INPUT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user