diff options
| author | Alexander Barton <alex@barton.de> | 2010-09-08 02:02:01 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2010-09-08 02:02:01 +0200 |
| commit | 6349ec8bb33d74aa73f0ffa17c29d54119ab9d77 (patch) | |
| tree | 90a8ba6d5902463ac8a16830576ace7711bf9100 /src | |
| parent | 8d68fe3f867732cbec094cdf7240a46e631c2838 (diff) | |
| download | ngircd-6349ec8bb33d74aa73f0ffa17c29d54119ab9d77.tar.gz ngircd-6349ec8bb33d74aa73f0ffa17c29d54119ab9d77.zip | |
Conn_SyncServerStruct(): test all connections; and work case insensitive
Fix synchronization of established connections and configured server structures after a configuration update: - Not only test servers that already have a connection, but also check and update configured servers to which a new connection is beeing established (SERVER_WAIT state). - And do the server name comparision case-insensitive.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/conn.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index a8e93a27..78a20b05 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1139,32 +1139,32 @@ Conn_CountAccepted(void) } /* Conn_CountAccepted */ +/** + * Synchronize established connections and configured server structures + * after a configuration update and store the correct connection IDs, if any. + */ GLOBAL void -Conn_SyncServerStruct( void ) +Conn_SyncServerStruct(void) { - /* Synchronize server structures (connection IDs): - * connections <-> configuration */ - CLIENT *client; CONN_ID i; int c; - for( i = 0; i < Pool_Size; i++ ) { - /* Established connection? */ - if (My_Connections[i].sock < 0) + for (i = 0; i < Pool_Size; i++) { + if (My_Connections[i].sock == NONE) continue; - /* Server connection? */ - client = Conn_GetClient( i ); - if(( ! client ) || ( Client_Type( client ) != CLIENT_SERVER )) continue; + /* Server link? */ + client = Conn_GetClient(i); + if (!client || Client_Type(client) != CLIENT_SERVER) + continue; - for( c = 0; c < MAX_SERVERS; c++ ) - { + for (c = 0; c < MAX_SERVERS; c++) { /* Configured server? */ - if( ! Conf_Server[c].host[0] ) continue; + if (!Conf_Server[c].host[0]) + continue; - /* Duplicate? */ - if( strcmp( Conf_Server[c].name, Client_ID( client )) == 0 ) + if (strcasecmp(Conf_Server[c].name, Client_ID(client)) == 0) Conf_Server[c].conn_id = i; } } |