Networker Increase logging on startup
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 19 Jan 2012 21:25:29 +0000 (22:25 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 19 Jan 2012 21:25:29 +0000 (22:25 +0100)
  - add a counter for networkers
  - log before starting the context
  - lock inside of the connect function.

citadel/modules/network/serv_networkclient.c

index c62e3f3ca9f9d894d43b1f9115f4362564b3bcd5..82b3920a03890f0d9af4461add425c0c6c49f022 100644 (file)
@@ -822,7 +822,6 @@ eNextState nwc_connect_ip(AsyncIO *IO)
        AsyncNetworker *NW = IO->Data;
 
        EVN_syslog(LOG_DEBUG, "%s\n", __FUNCTION__);
-       EVN_syslog(LOG_DEBUG, "network: polling <%s>\n", ChrPtr(NW->node));
        EVN_syslog(LOG_NOTICE, "Connecting to <%s> at %s:%s\n", 
                   ChrPtr(NW->node), 
                   ChrPtr(NW->host),
@@ -834,8 +833,14 @@ eNextState nwc_connect_ip(AsyncIO *IO)
                             1);
 }
 
+static int NetworkerCount = 0;
 void RunNetworker(AsyncNetworker *NW)
 {
+       AsyncIO *IO = &NW->IO;
+
+       NW->n = NetworkerCount++;
+       network_talking_to(SKEY(NW->node), NTT_ADD);
+       EVN_syslog(LOG_DEBUG, "network: polling <%s>\n", ChrPtr(NW->node));
        ParseURL(&NW->IO.ConnectMe, NW->Url, 504);
 
        InitIOStruct(&NW->IO,
@@ -938,7 +943,6 @@ void network_poll_other_citadel_nodes(int full_poll, char *working_ignetcfg)
                                             ChrPtr(NW->port));
                                if (!network_talking_to(SKEY(NW->node), NTT_CHECK))
                                {
-                                       network_talking_to(SKEY(NW->node), NTT_ADD);
                                        RunNetworker(NW);
                                        continue;
                                }