]> git.sesse.net Git - vlc/blobdiff - src/network/tcp.c
I hate Winsuck^H^H^Hock
[vlc] / src / network / tcp.c
index 4d62d36eebcb9982dc0076f5c1269d3ae2a68cf3..cdba85e2c15a0f2342a1e06e97ab59d47fabb951 100644 (file)
@@ -162,6 +162,7 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
                 msg_Err( p_this, "connection failed: %m" );
                 goto next_ai;
             }
+            msg_Dbg( p_this, "connection: %m" );
 
             var_Create( p_this, "ipv4-timeout",
                         VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
@@ -173,7 +174,6 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
             }
             d = div( timeout.i_int, 100 );
 
-            msg_Dbg( p_this, "connection in progress" );
             for (;;)
             {
                 struct pollfd ufd = { .fd = fd, .events = POLLOUT };
@@ -215,12 +215,14 @@ int __net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
             if( getsockopt( fd, SOL_SOCKET, SO_ERROR, (void*)&i_val,
                             &i_val_size ) == -1 || i_val != 0 )
             {
+                errno = i_val;
                 msg_Err( p_this, "connection failed: %m" );
                 goto next_ai;
             }
 #endif
         }
 
+        msg_Dbg( p_this, "connection succeeded (socket = %d)", fd );
         i_handle = fd; /* success! */
         break;