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
This commit is contained in:
Vadim Zeitlin
2010-01-26 23:04:26 +00:00
parent fb9521b8f5
commit 896576e31e
2 changed files with 4 additions and 0 deletions

View File

@@ -437,6 +437,7 @@ All:
- Added support for unique volume names to wxFileName (Neno Ganchev). - Added support for unique volume names to wxFileName (Neno Ganchev).
- Correct bugs when using wxTextInputStream with wxConvAuto (Leon Buikstra). - Correct bugs when using wxTextInputStream with wxConvAuto (Leon Buikstra).
- Don't crash when input is empty in wxFileConfig ctor (Lukasz Michalski). - Don't crash when input is empty in wxFileConfig ctor (Lukasz Michalski).
- Correct wxSocket::Peek() to not block (Anders Larsen).
Unix: Unix:

View File

@@ -1109,6 +1109,9 @@ wxSocketBase& wxSocketBase::Peek(void* buffer, wxUint32 nbytes)
{ {
wxSocketReadGuard read(this); wxSocketReadGuard read(this);
// Peek() should never block
wxSocketWaitModeChanger changeFlags(this, wxSOCKET_NOWAIT);
m_lcount = DoRead(buffer, nbytes); m_lcount = DoRead(buffer, nbytes);
Pushback(buffer, m_lcount); Pushback(buffer, m_lcount);