mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 02:42:58 +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 int lastError = WSAGetLastError();
|
||||
const int last_error = WSAGetLastError();
|
||||
// TODO: This is not a generic way to handle this...
|
||||
if (lastError == WSAEWOULDBLOCK)
|
||||
if (last_error == WSAEWOULDBLOCK)
|
||||
return NULL;
|
||||
|
||||
return wsa_error_no (lastError);
|
||||
return wsa_error_no (last_error);
|
||||
}
|
||||
|
||||
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);
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
if (rc == SOCKET_ERROR) {
|
||||
const int lastError = WSAGetLastError();
|
||||
wsa_assert (lastError != WSANOTINITIALISED &&
|
||||
lastError != WSAEFAULT &&
|
||||
lastError != WSAEINPROGRESS &&
|
||||
lastError != WSAENOTSOCK);
|
||||
const int last_error = WSAGetLastError();
|
||||
wsa_assert (last_error != WSANOTINITIALISED &&
|
||||
last_error != WSAEFAULT &&
|
||||
last_error != WSAEINPROGRESS &&
|
||||
last_error != WSAENOTSOCK);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
@ -368,11 +368,11 @@ int zmq::socks_connecter_t::connect_to_proxy ()
|
||||
// Translate error codes indicating asynchronous connect has been
|
||||
// launched to a uniform EINPROGRESS.
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
const int lastError = WSAGetLastError();
|
||||
if (lastError == WSAEINPROGRESS || lastError == WSAEWOULDBLOCK)
|
||||
const int last_error = WSAGetLastError();
|
||||
if (last_error == WSAEINPROGRESS || last_error == WSAEWOULDBLOCK)
|
||||
errno = EINPROGRESS;
|
||||
else {
|
||||
errno = wsa_error_to_errno (lastError);
|
||||
errno = wsa_error_to_errno (last_error);
|
||||
close ();
|
||||
}
|
||||
#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
|
||||
// we'll get an error (this may happen during the speculative write).
|
||||
const int lastError = WSAGetLastError();
|
||||
if (nbytes == SOCKET_ERROR && lastError == WSAEWOULDBLOCK)
|
||||
const int last_error = WSAGetLastError();
|
||||
if (nbytes == SOCKET_ERROR && last_error == WSAEWOULDBLOCK)
|
||||
return 0;
|
||||
|
||||
// Signalise peer failure.
|
||||
if (nbytes == SOCKET_ERROR && (
|
||||
lastError == WSAENETDOWN ||
|
||||
lastError == WSAENETRESET ||
|
||||
lastError == WSAEHOSTUNREACH ||
|
||||
lastError == WSAECONNABORTED ||
|
||||
lastError == WSAETIMEDOUT ||
|
||||
lastError == WSAECONNRESET
|
||||
last_error == WSAENETDOWN ||
|
||||
last_error == WSAENETRESET ||
|
||||
last_error == WSAEHOSTUNREACH ||
|
||||
last_error == WSAECONNABORTED ||
|
||||
last_error == WSAETIMEDOUT ||
|
||||
last_error == WSAECONNRESET
|
||||
))
|
||||
return -1;
|
||||
|
||||
// Circumvent a Windows bug; see https://support.microsoft.com/en-us/kb/201213
|
||||
// and https://zeromq.jira.com/browse/LIBZMQ-195
|
||||
if (nbytes == SOCKET_ERROR && lastError == WSAENOBUFS)
|
||||
if (nbytes == SOCKET_ERROR && last_error == WSAENOBUFS)
|
||||
return 0;
|
||||
|
||||
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
|
||||
// we'll get an error (this may happen during the speculative read).
|
||||
if (rc == SOCKET_ERROR) {
|
||||
const int lastError = WSAGetLastError();
|
||||
if (lastError == WSAEWOULDBLOCK) {
|
||||
const int last_error = WSAGetLastError();
|
||||
if (last_error == WSAEWOULDBLOCK) {
|
||||
errno = EAGAIN;
|
||||
}
|
||||
else {
|
||||
wsa_assert (lastError == WSAENETDOWN ||
|
||||
lastError == WSAENETRESET ||
|
||||
lastError == WSAECONNABORTED ||
|
||||
lastError == WSAETIMEDOUT ||
|
||||
lastError == WSAECONNRESET ||
|
||||
lastError == WSAECONNREFUSED ||
|
||||
lastError == WSAENOTCONN);
|
||||
errno = wsa_error_to_errno (lastError);
|
||||
wsa_assert (last_error == WSAENETDOWN ||
|
||||
last_error == WSAENETRESET ||
|
||||
last_error == WSAECONNABORTED ||
|
||||
last_error == WSAETIMEDOUT ||
|
||||
last_error == WSAECONNRESET ||
|
||||
last_error == WSAECONNREFUSED ||
|
||||
last_error == WSAENOTCONN);
|
||||
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
|
||||
// launched to a uniform EINPROGRESS.
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
const int lastError = WSAGetLastError();
|
||||
if (lastError == WSAEINPROGRESS || lastError == WSAEWOULDBLOCK)
|
||||
const int last_error = WSAGetLastError();
|
||||
if (last_error == WSAEINPROGRESS || last_error == WSAEWOULDBLOCK)
|
||||
errno = EINPROGRESS;
|
||||
else
|
||||
errno = wsa_error_to_errno (lastError);
|
||||
errno = wsa_error_to_errno (last_error);
|
||||
#else
|
||||
if (errno == EINTR)
|
||||
errno = EINPROGRESS;
|
||||
|
@ -278,11 +278,11 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
||||
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
if (sock == INVALID_SOCKET) {
|
||||
const int lastError = WSAGetLastError();
|
||||
wsa_assert (lastError == WSAEWOULDBLOCK ||
|
||||
lastError == WSAECONNRESET ||
|
||||
lastError == WSAEMFILE ||
|
||||
lastError == WSAENOBUFS);
|
||||
const int last_error = WSAGetLastError();
|
||||
wsa_assert (last_error == WSAEWOULDBLOCK ||
|
||||
last_error == WSAECONNRESET ||
|
||||
last_error == WSAEMFILE ||
|
||||
last_error == WSAENOBUFS);
|
||||
return retired_fd;
|
||||
}
|
||||
#if !defined _WIN32_WCE
|
||||
|
Loading…
Reference in New Issue
Block a user