mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Merge pull request #1521 from reza-ebrahimi/master
changing some camelCase variable names to snake_case in previous commit
This commit is contained in:
commit
eb2eec646f
@ -89,12 +89,12 @@ void zmq::zmq_abort(const char *errmsg_)
|
|||||||
|
|
||||||
const char *zmq::wsa_error()
|
const char *zmq::wsa_error()
|
||||||
{
|
{
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
// TODO: This is not a generic way to handle this...
|
// TODO: This is not a generic way to handle this...
|
||||||
if (lastError == WSAEWOULDBLOCK)
|
if (last_error == WSAEWOULDBLOCK)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return wsa_error_no (lastError);
|
return wsa_error_no (last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *zmq::wsa_error_no (int no_)
|
const char *zmq::wsa_error_no (int no_)
|
||||||
|
10
src/ip.cpp
10
src/ip.cpp
@ -132,11 +132,11 @@ int zmq::get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_)
|
|||||||
rc = getpeername (sockfd_, (struct sockaddr*) &ss, &addrlen);
|
rc = getpeername (sockfd_, (struct sockaddr*) &ss, &addrlen);
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
if (rc == SOCKET_ERROR) {
|
if (rc == SOCKET_ERROR) {
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
wsa_assert (lastError != WSANOTINITIALISED &&
|
wsa_assert (last_error != WSANOTINITIALISED &&
|
||||||
lastError != WSAEFAULT &&
|
last_error != WSAEFAULT &&
|
||||||
lastError != WSAEINPROGRESS &&
|
last_error != WSAEINPROGRESS &&
|
||||||
lastError != WSAENOTSOCK);
|
last_error != WSAENOTSOCK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -368,11 +368,11 @@ int zmq::socks_connecter_t::connect_to_proxy ()
|
|||||||
// Translate error codes indicating asynchronous connect has been
|
// Translate error codes indicating asynchronous connect has been
|
||||||
// launched to a uniform EINPROGRESS.
|
// launched to a uniform EINPROGRESS.
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
if (lastError == WSAEINPROGRESS || lastError == WSAEWOULDBLOCK)
|
if (last_error == WSAEINPROGRESS || last_error == WSAEWOULDBLOCK)
|
||||||
errno = EINPROGRESS;
|
errno = EINPROGRESS;
|
||||||
else {
|
else {
|
||||||
errno = wsa_error_to_errno (lastError);
|
errno = wsa_error_to_errno (last_error);
|
||||||
close ();
|
close ();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
38
src/tcp.cpp
38
src/tcp.cpp
@ -178,24 +178,24 @@ void zmq::tune_tcp_retransmit_timeout (fd_t sockfd_, int timeout_)
|
|||||||
|
|
||||||
// If not a single byte can be written to the socket in non-blocking mode
|
// If not a single byte can be written to the socket in non-blocking mode
|
||||||
// we'll get an error (this may happen during the speculative write).
|
// we'll get an error (this may happen during the speculative write).
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
if (nbytes == SOCKET_ERROR && lastError == WSAEWOULDBLOCK)
|
if (nbytes == SOCKET_ERROR && last_error == WSAEWOULDBLOCK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Signalise peer failure.
|
// Signalise peer failure.
|
||||||
if (nbytes == SOCKET_ERROR && (
|
if (nbytes == SOCKET_ERROR && (
|
||||||
lastError == WSAENETDOWN ||
|
last_error == WSAENETDOWN ||
|
||||||
lastError == WSAENETRESET ||
|
last_error == WSAENETRESET ||
|
||||||
lastError == WSAEHOSTUNREACH ||
|
last_error == WSAEHOSTUNREACH ||
|
||||||
lastError == WSAECONNABORTED ||
|
last_error == WSAECONNABORTED ||
|
||||||
lastError == WSAETIMEDOUT ||
|
last_error == WSAETIMEDOUT ||
|
||||||
lastError == WSAECONNRESET
|
last_error == WSAECONNRESET
|
||||||
))
|
))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Circumvent a Windows bug; see https://support.microsoft.com/en-us/kb/201213
|
// Circumvent a Windows bug; see https://support.microsoft.com/en-us/kb/201213
|
||||||
// and https://zeromq.jira.com/browse/LIBZMQ-195
|
// and https://zeromq.jira.com/browse/LIBZMQ-195
|
||||||
if (nbytes == SOCKET_ERROR && lastError == WSAENOBUFS)
|
if (nbytes == SOCKET_ERROR && last_error == WSAENOBUFS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
wsa_assert (nbytes != SOCKET_ERROR);
|
wsa_assert (nbytes != SOCKET_ERROR);
|
||||||
@ -240,19 +240,19 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
|
|||||||
// If not a single byte can be read from the socket in non-blocking mode
|
// If not a single byte can be read from the socket in non-blocking mode
|
||||||
// we'll get an error (this may happen during the speculative read).
|
// we'll get an error (this may happen during the speculative read).
|
||||||
if (rc == SOCKET_ERROR) {
|
if (rc == SOCKET_ERROR) {
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
if (lastError == WSAEWOULDBLOCK) {
|
if (last_error == WSAEWOULDBLOCK) {
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wsa_assert (lastError == WSAENETDOWN ||
|
wsa_assert (last_error == WSAENETDOWN ||
|
||||||
lastError == WSAENETRESET ||
|
last_error == WSAENETRESET ||
|
||||||
lastError == WSAECONNABORTED ||
|
last_error == WSAECONNABORTED ||
|
||||||
lastError == WSAETIMEDOUT ||
|
last_error == WSAETIMEDOUT ||
|
||||||
lastError == WSAECONNRESET ||
|
last_error == WSAECONNRESET ||
|
||||||
lastError == WSAECONNREFUSED ||
|
last_error == WSAECONNREFUSED ||
|
||||||
lastError == WSAENOTCONN);
|
last_error == WSAENOTCONN);
|
||||||
errno = wsa_error_to_errno (lastError);
|
errno = wsa_error_to_errno (last_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,11 +319,11 @@ int zmq::tcp_connecter_t::open ()
|
|||||||
// Translate error codes indicating asynchronous connect has been
|
// Translate error codes indicating asynchronous connect has been
|
||||||
// launched to a uniform EINPROGRESS.
|
// launched to a uniform EINPROGRESS.
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
if (lastError == WSAEINPROGRESS || lastError == WSAEWOULDBLOCK)
|
if (last_error == WSAEINPROGRESS || last_error == WSAEWOULDBLOCK)
|
||||||
errno = EINPROGRESS;
|
errno = EINPROGRESS;
|
||||||
else
|
else
|
||||||
errno = wsa_error_to_errno (lastError);
|
errno = wsa_error_to_errno (last_error);
|
||||||
#else
|
#else
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
errno = EINPROGRESS;
|
errno = EINPROGRESS;
|
||||||
|
@ -278,11 +278,11 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
|||||||
|
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
if (sock == INVALID_SOCKET) {
|
if (sock == INVALID_SOCKET) {
|
||||||
const int lastError = WSAGetLastError();
|
const int last_error = WSAGetLastError();
|
||||||
wsa_assert (lastError == WSAEWOULDBLOCK ||
|
wsa_assert (last_error == WSAEWOULDBLOCK ||
|
||||||
lastError == WSAECONNRESET ||
|
last_error == WSAECONNRESET ||
|
||||||
lastError == WSAEMFILE ||
|
last_error == WSAEMFILE ||
|
||||||
lastError == WSAENOBUFS);
|
last_error == WSAENOBUFS);
|
||||||
return retired_fd;
|
return retired_fd;
|
||||||
}
|
}
|
||||||
#if !defined _WIN32_WCE
|
#if !defined _WIN32_WCE
|
||||||
|
Loading…
Reference in New Issue
Block a user