Fix logic problems with NETCON_connected

Mike McCormack mike at codeweavers.com
Tue Sep 23 05:14:14 CDT 2003


ChangeLog:
* Fix logic problems with NETCON_connected
-------------- next part --------------
Index: dlls/wininet/netconnection.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/netconnection.c,v
retrieving revision 1.3
diff -u -r1.3 netconnection.c
--- dlls/wininet/netconnection.c	5 Sep 2003 23:08:28 -0000	1.3
+++ dlls/wininet/netconnection.c	22 Sep 2003 06:48:07 -0000
@@ -224,7 +224,7 @@
  */
 BOOL NETCON_close(WININET_NETCONNECTION *connection)
 {
-    if (!NETCON_connected) return FALSE;
+    if (!NETCON_connected(connection)) return FALSE;
     if (!connection->useSSL)
     {
         int result;
@@ -255,13 +255,17 @@
 BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr,
 		    socklen_t addrlen)
 {
-    if (!NETCON_connected) return FALSE;
+    if (!NETCON_connected(connection)) return FALSE;
     if (!connection->useSSL)
     {
 	int result;
 	result = connect(connection->socketFD, serv_addr, addrlen);
 	if (result == -1)
+        {
+            close(connection->socketFD);
+            connection->socketFD = -1;
 	    return FALSE;
+        }
         return TRUE;
     }
     else
@@ -297,7 +301,7 @@
 BOOL NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags,
 		int *sent /* out */)
 {
-    if (!NETCON_connected) return FALSE;
+    if (!NETCON_connected(connection)) return FALSE;
     if (!connection->useSSL)
     {
 	*sent = send(connection->socketFD, msg, len, flags);
@@ -328,7 +332,7 @@
 BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags,
 		int *recvd /* out */)
 {
-    if (!NETCON_connected) return FALSE;
+    if (!NETCON_connected(connection)) return FALSE;
     if (!connection->useSSL)
     {
 	*recvd = recv(connection->socketFD, buf, len, flags);


More information about the wine-patches mailing list