wininet: Renamed socketFD to socket.

This commit is contained in:
Jacek Caban 2013-03-01 11:16:17 +01:00 committed by Alexandre Julliard
parent c6ee6d6c9e
commit febbb85528
2 changed files with 22 additions and 22 deletions

View File

@ -89,8 +89,8 @@ BOOL collect_connections(collect_type_t) DECLSPEC_HIDDEN;
/* used for netconnection.c stuff */ /* used for netconnection.c stuff */
typedef struct typedef struct
{ {
int socket;
BOOL secure; BOOL secure;
int socketFD;
void *ssl_s; void *ssl_s;
server_t *server; server_t *server;
DWORD security_flags; DWORD security_flags;

View File

@ -610,39 +610,39 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
int result, flag; int result, flag;
assert(server->addr_len); assert(server->addr_len);
result = netconn->socketFD = socket(server->addr.ss_family, SOCK_STREAM, 0); result = netconn->socket = socket(server->addr.ss_family, SOCK_STREAM, 0);
if(result != -1) { if(result != -1) {
flag = 1; flag = 1;
ioctlsocket(netconn->socketFD, FIONBIO, &flag); ioctlsocket(netconn->socket, FIONBIO, &flag);
result = connect(netconn->socketFD, (struct sockaddr*)&server->addr, server->addr_len); result = connect(netconn->socket, (struct sockaddr*)&server->addr, server->addr_len);
if(result == -1) if(result == -1)
{ {
if (sock_get_error(errno) == WSAEINPROGRESS) { if (sock_get_error(errno) == WSAEINPROGRESS) {
struct pollfd pfd; struct pollfd pfd;
int res; int res;
pfd.fd = netconn->socketFD; pfd.fd = netconn->socket;
pfd.events = POLLOUT; pfd.events = POLLOUT;
res = poll(&pfd, 1, timeout); res = poll(&pfd, 1, timeout);
if (!res) if (!res)
{ {
closesocket(netconn->socketFD); closesocket(netconn->socket);
return ERROR_INTERNET_CANNOT_CONNECT; return ERROR_INTERNET_CANNOT_CONNECT;
} }
else if (res > 0) else if (res > 0)
{ {
int err; int err;
socklen_t len = sizeof(err); socklen_t len = sizeof(err);
if (!getsockopt(netconn->socketFD, SOL_SOCKET, SO_ERROR, &err, &len) && !err) if (!getsockopt(netconn->socket, SOL_SOCKET, SO_ERROR, &err, &len) && !err)
result = 0; result = 0;
} }
} }
} }
if(result == -1) if(result == -1)
closesocket(netconn->socketFD); closesocket(netconn->socket);
else { else {
flag = 0; flag = 0;
ioctlsocket(netconn->socketFD, FIONBIO, &flag); ioctlsocket(netconn->socket, FIONBIO, &flag);
} }
} }
if(result == -1) if(result == -1)
@ -650,7 +650,7 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t
#ifdef TCP_NODELAY #ifdef TCP_NODELAY
flag = 1; flag = 1;
result = setsockopt(netconn->socketFD, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(flag)); result = setsockopt(netconn->socket, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(flag));
if(result < 0) if(result < 0)
WARN("setsockopt(TCP_NODELAY) failed\n"); WARN("setsockopt(TCP_NODELAY) failed\n");
#endif #endif
@ -681,7 +681,7 @@ DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, BOOL m
if(!netconn) if(!netconn)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
netconn->socketFD = -1; netconn->socket = -1;
netconn->security_flags = security_flags | server->security_flags; netconn->security_flags = security_flags | server->security_flags;
netconn->mask_errors = mask_errors; netconn->mask_errors = mask_errors;
list_init(&netconn->pool_entry); list_init(&netconn->pool_entry);
@ -709,7 +709,7 @@ void free_netconn(netconn_t *netconn)
} }
#endif #endif
closesocket(netconn->socketFD); closesocket(netconn->socket);
heap_free(netconn); heap_free(netconn);
} }
@ -823,7 +823,7 @@ static DWORD netcon_secure_connect_setup(netconn_t *connection, long tls_option)
} }
pSSL_set_options(ssl_s, tls_option); pSSL_set_options(ssl_s, tls_option);
if (!pSSL_set_fd(ssl_s, connection->socketFD)) if (!pSSL_set_fd(ssl_s, connection->socket))
{ {
ERR("SSL_set_fd failed: %s\n", ERR("SSL_set_fd failed: %s\n",
pERR_error_string(pERR_get_error(), 0)); pERR_error_string(pERR_get_error(), 0));
@ -904,7 +904,7 @@ DWORD NETCON_secure_connect(netconn_t *connection, server_t *server)
/* fallback to connect without TLSv1.1/TLSv1.2 */ /* fallback to connect without TLSv1.1/TLSv1.2 */
if (res == ERROR_INTERNET_SECURITY_CHANNEL_ERROR) if (res == ERROR_INTERNET_SECURITY_CHANNEL_ERROR)
{ {
closesocket(connection->socketFD); closesocket(connection->socket);
pSSL_CTX_set_options(ctx,SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2); pSSL_CTX_set_options(ctx,SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
res = create_netconn_socket(connection->server, connection, 500); res = create_netconn_socket(connection->server, connection, 500);
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
@ -928,7 +928,7 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
{ {
if(!connection->secure) if(!connection->secure)
{ {
*sent = send(connection->socketFD, msg, len, flags); *sent = send(connection->socket, msg, len, flags);
if (*sent == -1) if (*sent == -1)
return sock_get_error(errno); return sock_get_error(errno);
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -966,7 +966,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, int *
if (!connection->secure) if (!connection->secure)
{ {
*recvd = recv(connection->socketFD, buf, len, flags); *recvd = recv(connection->socket, buf, len, flags);
return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS; return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS;
} }
else else
@ -1004,7 +1004,7 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
{ {
#ifdef FIONREAD #ifdef FIONREAD
int unread; int unread;
int retval = ioctlsocket(connection->socketFD, FIONREAD, &unread); int retval = ioctlsocket(connection->socket, FIONREAD, &unread);
if (!retval) if (!retval)
{ {
TRACE("%d bytes of queued, but unread data\n", unread); TRACE("%d bytes of queued, but unread data\n", unread);
@ -1030,7 +1030,7 @@ BOOL NETCON_is_alive(netconn_t *netconn)
ssize_t len; ssize_t len;
BYTE b; BYTE b;
len = recv(netconn->socketFD, &b, 1, MSG_PEEK|MSG_DONTWAIT); len = recv(netconn->socket, &b, 1, MSG_PEEK|MSG_DONTWAIT);
return len == 1 || (len == -1 && errno == EWOULDBLOCK); return len == 1 || (len == -1 && errno == EWOULDBLOCK);
#elif defined(__MINGW32__) || defined(_MSC_VER) #elif defined(__MINGW32__) || defined(_MSC_VER)
ULONG mode; ULONG mode;
@ -1038,13 +1038,13 @@ BOOL NETCON_is_alive(netconn_t *netconn)
char b; char b;
mode = 1; mode = 1;
if(!ioctlsocket(netconn->socketFD, FIONBIO, &mode)) if(!ioctlsocket(netconn->socket, FIONBIO, &mode))
return FALSE; return FALSE;
len = recv(netconn->socketFD, &b, 1, MSG_PEEK); len = recv(netconn->socket, &b, 1, MSG_PEEK);
mode = 0; mode = 0;
if(!ioctlsocket(netconn->socketFD, FIONBIO, &mode)) if(!ioctlsocket(netconn->socket, FIONBIO, &mode))
return FALSE; return FALSE;
return len == 1 || (len == -1 && errno == WSAEWOULDBLOCK); return len == 1 || (len == -1 && errno == WSAEWOULDBLOCK);
@ -1111,7 +1111,7 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value)
tv.tv_sec = value / 1000; tv.tv_sec = value / 1000;
tv.tv_usec = (value % 1000) * 1000; tv.tv_usec = (value % 1000) * 1000;
} }
result = setsockopt(connection->socketFD, SOL_SOCKET, result = setsockopt(connection->socket, SOL_SOCKET,
send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&tv, send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&tv,
sizeof(tv)); sizeof(tv));
if (result == -1) if (result == -1)