mirror of
https://github.com/zeromq/libzmq.git
synced 2025-09-17 19:44:01 +02:00
Fixed handling of WSAEWOULDBLOCK to be generic (#2260)
* Fixed handling of WSAEWOULDBLOCK to be generic I don't know what was the intention of this early if statement but now this is properly evaluated in wsa_error_no function if this is performance issue I suggest moving evaluating this error code to the beginning of wsa_error_no. * Fixed handling of WSAEWOULDBLOCK to be generic Introduced default pointer to const char * and overrides this as NULL if function is called by zmq::wsa_error() * Fixed handling of WSAEWOULDBLOCK to be generic Introduced default pointer to const char * and overrides this as NULL if function is called by zmq::wsa_error()
This commit is contained in:
parent
2b565088d0
commit
d514bb598a
11
src/err.cpp
11
src/err.cpp
@ -92,15 +92,10 @@ void zmq::zmq_abort(const char *errmsg_)
|
||||
|
||||
const char *zmq::wsa_error()
|
||||
{
|
||||
const int last_error = WSAGetLastError();
|
||||
// TODO: This is not a generic way to handle this...
|
||||
if (last_error == WSAEWOULDBLOCK)
|
||||
return NULL;
|
||||
|
||||
return wsa_error_no (last_error);
|
||||
return wsa_error_no (WSAGetLastError(), NULL);
|
||||
}
|
||||
|
||||
const char *zmq::wsa_error_no (int no_)
|
||||
const char *zmq::wsa_error_no (int no_, const char * wsae_wouldblock_string)
|
||||
{
|
||||
// TODO: It seems that list of Windows socket errors is longer than this.
|
||||
// Investigate whether there's a way to convert it into the string
|
||||
@ -121,7 +116,7 @@ const char *zmq::wsa_error_no (int no_)
|
||||
(no_ == WSAEMFILE) ?
|
||||
"Too many open files" :
|
||||
(no_ == WSAEWOULDBLOCK) ?
|
||||
"Operation would block" :
|
||||
wsae_wouldblock_string :
|
||||
(no_ == WSAEINPROGRESS) ?
|
||||
"Operation now in progress" :
|
||||
(no_ == WSAEALREADY) ?
|
||||
|
@ -65,7 +65,7 @@ namespace zmq
|
||||
namespace zmq
|
||||
{
|
||||
const char *wsa_error ();
|
||||
const char *wsa_error_no (int no_);
|
||||
const char *wsa_error_no (int no_, const char * wsae_wouldblock_string = "Operation would block");
|
||||
void win_error (char *buffer_, size_t buffer_size_);
|
||||
int wsa_error_to_errno (int errcode);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user