瀏覽代碼

- having a read event on an already referenced tcp_conn is not a bug
(it could be referenced by a sender)

Andrei Pelinescu-Onciul 20 年之前
父節點
當前提交
d4652e3337
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. 1 1
      Makefile.defs
  2. 8 1
      tcp_main.c

+ 1 - 1
Makefile.defs

@@ -60,7 +60,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 10
 PATCHLEVEL = 10
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev18-tcp
+EXTRAVERSION = -dev20-tcp
 
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 8 - 1
tcp_main.c

@@ -1082,7 +1082,13 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, int fd_i)
 {
 {
 	int fd;
 	int fd;
 	
 	
-	/* FIXME: is refcnt!=0 really necessary? */
+	/*  is refcnt!=0 really necessary? 
+	 *  No, in fact it's a bug: I can have the following situation: a send only
+	 *   tcp connection used by n processes simultaneously => refcnt = n. In 
+	 *   the same time I can have a read event and this situation is perfectly
+	 *   valid. -- andrei
+	 */
+#if 0
 	if ((tcpconn->refcnt!=0)){
 	if ((tcpconn->refcnt!=0)){
 		/* FIXME: might be valid for sigio_rt iff fd flags are not cleared
 		/* FIXME: might be valid for sigio_rt iff fd flags are not cleared
 		 *        (there is a short window in which it could generate a sig
 		 *        (there is a short window in which it could generate a sig
@@ -1092,6 +1098,7 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, int fd_i)
 					tcpconn, tcpconn->refcnt, tcpconn->s);
 					tcpconn, tcpconn->refcnt, tcpconn->s);
 		return -1;
 		return -1;
 	}
 	}
+#endif
 	/* pass it to child, so remove it from the io watch list */
 	/* pass it to child, so remove it from the io watch list */
 	DBG("handle_tcpconn_ev: data available on %p %d\n", tcpconn, tcpconn->s);
 	DBG("handle_tcpconn_ev: data available on %p %d\n", tcpconn, tcpconn->s);
 	if (io_watch_del(&io_h, tcpconn->s, fd_i, 0)==-1) goto error;
 	if (io_watch_del(&io_h, tcpconn->s, fd_i, 0)==-1) goto error;