Skip to content
This repository was archived by the owner on Apr 14, 2019. It is now read-only.

Commit 6f38f62

Browse files
author
Jakob Schröter
committed
** forwardport of rev 4760 from 1.0 branch **
1 parent 126953e commit 6f38f62

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Note: This release is not binary compatible with previous releases. It is source
2121
- CertInfo struct: fixed protocol version when using OpenSSL
2222
- TLSOpenSSL: fixed compilation with OpenSSL 1.1.0
2323
- Registration: added Resource Constraint error condition (thanks to elexis1987) (#267)
24+
- ConnectionTCP: fixed some blocking (thanks to Marco Ciprietti)
2425

2526

2627

src/connectiontcpclient.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ namespace gloox
136136
return ConnNoError;
137137
}
138138

139+
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
140+
int size = static_cast<int>( ::recv( m_socket, m_buf, m_bufsize ) );
141+
#else
139142
int size = static_cast<int>( ::recv( m_socket, m_buf, m_bufsize, 0 ) );
143+
#endif
140144
if( size > 0 )
141145
m_totalBytesIn += size;
142146

@@ -146,6 +150,12 @@ namespace gloox
146150
{
147151
if( size == -1 )
148152
{
153+
154+
#if defined(__unix__)
155+
if( errno == EAGAIN || errno == EWOULDBLOCK )
156+
return ConnNoError;
157+
#endif
158+
149159
// recv() failed for an unexpected reason
150160
std::string message = "recv() failed. "
151161
#if defined( _WIN32 )

0 commit comments

Comments
 (0)