From: Vadim Zeitlin Date: Tue, 26 Jan 2010 23:04:26 +0000 (+0000) Subject: Never block in wxSocket::Peek(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/896576e31e1a1320533ffb40d36f286618cffcff Never block in wxSocket::Peek(). Peek() is not expected to block so ensure that it doesn't, independently of the currently used socket flags, by using wxSOCKET_NOWAIT. See #11528. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63282 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index c719399322..573305c573 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -437,6 +437,7 @@ All: - Added support for unique volume names to wxFileName (Neno Ganchev). - Correct bugs when using wxTextInputStream with wxConvAuto (Leon Buikstra). - Don't crash when input is empty in wxFileConfig ctor (Lukasz Michalski). +- Correct wxSocket::Peek() to not block (Anders Larsen). Unix: diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 44b408c49c..228fe79a28 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -1109,6 +1109,9 @@ wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes) { wxSocketReadGuard read(this); + // Peek() should never block + wxSocketWaitModeChanger changeFlags(this, wxSOCKET_NOWAIT); + m_lcount = DoRead(buffer, nbytes); Pushback(buffer, m_lcount);