diff options
| author | Alexander Barton <alex@barton.de> | 2003-02-21 19:19:27 +0000 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2003-02-21 19:19:27 +0000 |
| commit | cf4ad8d6f7f9adffda596d67551811ac26f6a35a (patch) | |
| tree | baa72d7f5dd0947c2a1719571e49695202c70a2b | |
| parent | 2a3f8cc57d1e4797731e6e06649b32e57067c19b (diff) | |
| download | ngircd-cf4ad8d6f7f9adffda596d67551811ac26f6a35a.tar.gz ngircd-cf4ad8d6f7f9adffda596d67551811ac26f6a35a.zip | |
- Conn_Close() ignores recursive calls for the same link now.
| -rw-r--r-- | src/ngircd/conn.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 1819e36f..37c5c381 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -16,7 +16,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn.c,v 1.115 2003/01/15 14:28:59 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.116 2003/02/21 19:19:27 alex Exp $"; #include "imp.h" #include <assert.h> @@ -529,6 +529,17 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ) assert( Idx > NONE ); assert( My_Connections[Idx].sock > NONE ); + /* Is this link already shutting down? */ + if( My_Connections[Idx].options & CONN_ISCLOSING ) + { + /* Conn_Close() has been called recursively for this link; + * probabe reason: Try_Write() failed -- see below. */ + return; + } + + /* Mark link as "closing" */ + My_Connections[Idx].options |= CONN_ISCLOSING; + /* Search client, if any */ c = Client_GetFromConn( Idx ); @@ -550,7 +561,7 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ) } /* Try to write out the write buffer */ - Try_Write( Idx ); + (VOID)Try_Write( Idx ); /* Shut down socket */ if( close( My_Connections[Idx].sock ) != 0 ) |