Browse code

tcp: comments & new internal command

- commented the enum conn_cmds members
- added new cmd. CONN_NOP

Andrei Pelinescu-Onciul authored on 23/03/2010 16:54:12
Showing 1 changed files
... ...
@@ -98,11 +98,26 @@ enum tcp_conn_states { S_CONN_ERROR=-2, S_CONN_BAD=-1,
98 98
 
99 99
 
100 100
 /* fd communication commands */
101
-enum conn_cmds { CONN_DESTROY=-3, CONN_ERROR=-2, CONN_EOF=-1, CONN_RELEASE, 
102
-					CONN_GET_FD, CONN_NEW, CONN_QUEUED_WRITE,
103
-					CONN_NEW_PENDING_WRITE, CONN_NEW_COMPLETE };
101
+enum conn_cmds {
102
+	CONN_DESTROY=-3 /* destroy connection & auto-dec. refcnt */,
103
+	CONN_ERROR=-2   /* error on connection & auto-dec. refcnt */,
104
+	CONN_EOF=-1     /* eof received or conn. closed & auto-dec refcnt */,
105
+	CONN_NOP=0      /* do-nothing (invalid for tcp_main) */,
106
+	CONN_RELEASE    /* release a connection from tcp_read back into tcp_main
107
+					   & auto-dec refcnt */,
108
+	CONN_GET_FD     /* request a fd from tcp_main */,
109
+	CONN_NEW        /* update/set a fd int a new tcp connection; refcnts are
110
+					  not touched */,
111
+	CONN_QUEUED_WRITE /* new write queue: start watching the fd for write &
112
+						 auto-dec refcnt */,
113
+	CONN_NEW_PENDING_WRITE /* like CONN_NEW+CONN_QUEUED_WRITE: set fd and
114
+							  start watching it for write (write queue
115
+							  non-empty); refcnts are not touced */,
116
+	CONN_NEW_COMPLETE  /* like CONN_NEW_PENDING_WRITE, but there is no
117
+						  pending write (the write queue might be empty) */
118
+};
104 119
 /* CONN_RELEASE, EOF, ERROR, DESTROY can be used by "reader" processes
105
- * CONN_GET_FD, NEW, ERROR only by writers */
120
+ * CONN_GET_FD, CONN_NEW*, CONN_QUEUED_WRITE only by writers */
106 121
 
107 122
 struct tcp_req{
108 123
 	struct tcp_req* next;