Merge pull request #8 from csoler/v0.6-TorControl

Fixes for FriendServer
This commit is contained in:
csoler 2022-01-31 15:40:25 +01:00 committed by GitHub
commit 68864cbd70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -476,6 +476,14 @@ int unix_getsockopt_error(int sockfd, int *err)
return ret;
}
int rs_socket_error()
{
#ifdef WINDOWS_SYS // ie WINDOWS.
return WinToUnixError(WSAGetLastError());
#else
return errno;
#endif
}
/******************* WINDOWS SPECIFIC PART ******************/
#ifdef WINDOWS_SYS // ie WINDOWS.
@ -490,7 +498,7 @@ int WinToUnixError(int error)
return EINPROGRESS;
break;
case WSAEWOULDBLOCK:
return EINPROGRESS;
return EWOULDBLOCK;
break;
case WSAENETUNREACH:
return ENETUNREACH;

View File

@ -105,6 +105,8 @@ int unix_fcntl_nonblock(int sockfd);
int unix_connect(int sockfd, const sockaddr_storage& serv_addr);
int unix_getsockopt_error(int sockfd, int *err);
int rs_socket_error();
#ifdef WINDOWS_SYS // WINDOWS
/******************* WINDOWS SPECIFIC PART ******************/
RS_DEPRECATED_FOR("use std::error_condition instead")