Use a new flag to remember which connection were passively opened (accept()) and which were locally initiated (connect).
@@ -75,6 +75,7 @@
#define F_CONN_WR_ERROR 2048 /* write error on the fd */
#define F_CONN_WANTS_RD 4096 /* conn. should be watched for READ */
#define F_CONN_WANTS_WR 8192 /* conn. should be watched for WRITE */
+#define F_CONN_PASSIVE 16384 /* conn. created via accept() and not connect()*/
enum tcp_req_errors { TCP_REQ_INIT, TCP_REQ_OK, TCP_READ_ERROR,
@@ -3433,6 +3433,7 @@ static inline int handle_new_connect(struct socket_info* si)
/* add socket to list */
tcpconn=tcpconn_new(new_sock, &su, dst_su, si, si->proto, S_CONN_ACCEPT);
if (likely(tcpconn)){
+ tcpconn->flags|=F_CONN_PASSIVE;
#ifdef TCP_PASS_NEW_CONNECTION_ON_DATA
atomic_set(&tcpconn->refcnt, 1); /* safe, not yet available to the
outside world */