mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
net: remove unnecessary casts in socket operations
These methods in the Sock class wrap corresponding syscalls, accepting void* arguments and casting to char* internally, which is needed for Windows support and ignored on other platforms because the syscall itself accepts void*: Send() Recv() GetSockOpt() SetSockOpt()
This commit is contained in:
@@ -551,7 +551,7 @@ std::unique_ptr<Sock> CreateSockOS(int domain, int type, int protocol)
|
||||
int set = 1;
|
||||
// Set the no-sigpipe option on the socket for BSD systems, other UNIXes
|
||||
// should use the MSG_NOSIGNAL flag for every send.
|
||||
if (sock->SetSockOpt(SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)) == SOCKET_ERROR) {
|
||||
if (sock->SetSockOpt(SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(int)) == SOCKET_ERROR) {
|
||||
LogPrintf("Error setting SO_NOSIGPIPE on socket: %s, continuing anyway\n",
|
||||
NetworkErrorString(WSAGetLastError()));
|
||||
}
|
||||
@@ -620,7 +620,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
|
||||
// sockerr here.
|
||||
int sockerr;
|
||||
socklen_t sockerr_len = sizeof(sockerr);
|
||||
if (sock.GetSockOpt(SOL_SOCKET, SO_ERROR, (sockopt_arg_type)&sockerr, &sockerr_len) ==
|
||||
if (sock.GetSockOpt(SOL_SOCKET, SO_ERROR, &sockerr, &sockerr_len) ==
|
||||
SOCKET_ERROR) {
|
||||
LogPrintf("getsockopt() for %s failed: %s\n", dest_str, NetworkErrorString(WSAGetLastError()));
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user