Whamcloud - gitweb
* newconfig liblustre/tcpnal runs sanity OK
authoreeb <eeb>
Fri, 8 Jul 2005 14:51:27 +0000 (14:51 +0000)
committereeb <eeb>
Fri, 8 Jul 2005 14:51:27 +0000 (14:51 +0000)
lnet/ulnds/connection.c
lnet/ulnds/proclib.c
lnet/ulnds/socklnd/connection.c
lnet/ulnds/socklnd/proclib.c

index 67abfe3..fa13787 100644 (file)
@@ -110,6 +110,14 @@ static unsigned int connection_key(void *arg)
         return (unsigned int)(*nid);
 }
 
+void
+close_connection(void *arg)
+{
+        connection c = arg;
+        
+        close(c->fd);
+        free(c);
+}
 
 /* Function:  remove_connection
  * Arguments: c: the connection to remove
@@ -119,8 +127,7 @@ void remove_connection(void *arg)
         connection c = arg;
         
         hash_table_remove(c->m->connections,&c->peer_nid);
-        close(c->fd);
-        free(c);
+        close_connection(c);
 }
 
 
@@ -535,7 +542,7 @@ void shutdown_connections(manager m)
         close(m->bound);
         remove_io_handler(m->bound_handler);
 #endif
-        hash_destroy_table(m->connections,remove_connection);
+        hash_destroy_table(m->connections,close_connection);
         free(m);
 }
 
index c2dda30..b42581a 100644 (file)
@@ -53,12 +53,13 @@ static void check_stopping(void *z)
     if ((p->nal_flags & NAL_FLAG_STOPPING) == 0)
             return;
     
+    tcpnal_shutdown(b);
+
     pthread_mutex_lock(&p->mutex);
     p->nal_flags |= NAL_FLAG_STOPPED;
     pthread_cond_broadcast(&p->cond);
     pthread_mutex_unlock(&p->mutex);
 
-    tcpnal_shutdown(b);
     pthread_exit(0);
 }
 
index 67abfe3..fa13787 100644 (file)
@@ -110,6 +110,14 @@ static unsigned int connection_key(void *arg)
         return (unsigned int)(*nid);
 }
 
+void
+close_connection(void *arg)
+{
+        connection c = arg;
+        
+        close(c->fd);
+        free(c);
+}
 
 /* Function:  remove_connection
  * Arguments: c: the connection to remove
@@ -119,8 +127,7 @@ void remove_connection(void *arg)
         connection c = arg;
         
         hash_table_remove(c->m->connections,&c->peer_nid);
-        close(c->fd);
-        free(c);
+        close_connection(c);
 }
 
 
@@ -535,7 +542,7 @@ void shutdown_connections(manager m)
         close(m->bound);
         remove_io_handler(m->bound_handler);
 #endif
-        hash_destroy_table(m->connections,remove_connection);
+        hash_destroy_table(m->connections,close_connection);
         free(m);
 }
 
index c2dda30..b42581a 100644 (file)
@@ -53,12 +53,13 @@ static void check_stopping(void *z)
     if ((p->nal_flags & NAL_FLAG_STOPPING) == 0)
             return;
     
+    tcpnal_shutdown(b);
+
     pthread_mutex_lock(&p->mutex);
     p->nal_flags |= NAL_FLAG_STOPPED;
     pthread_cond_broadcast(&p->cond);
     pthread_mutex_unlock(&p->mutex);
 
-    tcpnal_shutdown(b);
     pthread_exit(0);
 }