[PVFS2-CVS] commit by pcarns in pvfs2/src/io/bmi/bmi_tcp: socket-collection.h

CVS commit program cvs at parl.clemson.edu
Thu Mar 4 18:21:40 EST 2004


Update of /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp
In directory parlweb:/tmp/cvs-serv30324/src/io/bmi/bmi_tcp

Modified Files:
	socket-collection.h 
Log Message:
fix braindead socket handling; don't try to poll on sockets before we have
connected them to something :)


Index: socket-collection.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_tcp/socket-collection.h,v
diff -p -u -r1.9 -r1.10
--- socket-collection.h	3 Mar 2004 19:53:15 -0000	1.9
+++ socket-collection.h	4 Mar 2004 23:21:40 -0000	1.10
@@ -51,11 +51,17 @@ enum
 socket_collection_p BMI_socket_collection_init(int new_server_socket);
 void BMI_socket_collection_queue(socket_collection_p scp,
 			   method_addr_p map, struct qlist_head* queue);
+/* the bmi_tcp code may try to add a socket to the collection before
+ * it is fully connected, just ignore in this case
+ */
 #define BMI_socket_collection_add(s, m) \
 do { \
-    gen_mutex_lock(&((s)->queue_mutex)); \
-    BMI_socket_collection_queue(s, m, &((s)->add_queue)); \
-    gen_mutex_unlock(&((s)->queue_mutex)); \
+    struct tcp_addr* tcp_data = (m)->method_data; \
+    if(tcp_data->socket > -1){ \
+	gen_mutex_lock(&((s)->queue_mutex)); \
+	BMI_socket_collection_queue(s, m, &((s)->add_queue)); \
+	gen_mutex_unlock(&((s)->queue_mutex)); \
+    } \
 } while(0)
 
 #define BMI_socket_collection_remove(s, m) \
@@ -65,9 +71,11 @@ do { \
     gen_mutex_unlock(&((s)->queue_mutex)); \
 } while(0)
 
+/* we _must_ have a valid socket at this point if we want to write data */
 #define BMI_socket_collection_add_write_bit(s, m) \
 do { \
     struct tcp_addr* tcp_data = (m)->method_data; \
+    assert(tcp_data->socket > -1); \
     gen_mutex_lock(&((s)->queue_mutex)); \
     tcp_data->write_ref_count++; \
     BMI_socket_collection_queue((s),(m), &((s)->add_queue)); \



More information about the PVFS2-CVS mailing list