|
|
|
@ -74,20 +74,6 @@ static grpc_error* set_dualstack(SOCKET sock) { |
|
|
|
|
: GRPC_WSA_ERROR(WSAGetLastError(), "setsockopt(IPV6_V6ONLY)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static grpc_error* enable_loopback_fast_path(SOCKET sock) { |
|
|
|
|
int status; |
|
|
|
|
uint32_t param = 1; |
|
|
|
|
DWORD ret; |
|
|
|
|
status = WSAIoctl(sock, /*SIO_LOOPBACK_FAST_PATH==*/_WSAIOW(IOC_VENDOR, 16), |
|
|
|
|
¶m, sizeof(param), NULL, 0, &ret, 0, 0); |
|
|
|
|
if (status == SOCKET_ERROR) { |
|
|
|
|
status = WSAGetLastError(); |
|
|
|
|
} |
|
|
|
|
return status == 0 || status == WSAEOPNOTSUPP |
|
|
|
|
? GRPC_ERROR_NONE |
|
|
|
|
: GRPC_WSA_ERROR(status, "WSAIoctl(SIO_LOOPBACK_FAST_PATH)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static grpc_error* enable_socket_low_latency(SOCKET sock) { |
|
|
|
|
int status; |
|
|
|
|
BOOL param = TRUE; |
|
|
|
@ -106,8 +92,6 @@ grpc_error* grpc_tcp_prepare_socket(SOCKET sock) { |
|
|
|
|
if (err != GRPC_ERROR_NONE) return err; |
|
|
|
|
err = set_dualstack(sock); |
|
|
|
|
if (err != GRPC_ERROR_NONE) return err; |
|
|
|
|
err = enable_loopback_fast_path(sock); |
|
|
|
|
if (err != GRPC_ERROR_NONE) return err; |
|
|
|
|
err = enable_socket_low_latency(sock); |
|
|
|
|
if (err != GRPC_ERROR_NONE) return err; |
|
|
|
|
return GRPC_ERROR_NONE; |
|
|
|
|