add some logging
authorChristian Grothoff <christian@grothoff.org>
Sun, 10 Feb 2019 22:02:06 +0000 (23:02 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sun, 10 Feb 2019 22:02:06 +0000 (23:02 +0100)
src/ats/gnunet-service-ats-new.c
src/ats/test_ats2_lib.c

index dd65d54a27341eabe00938141884cbe402f1b9c5..a1666d8d3e9205ad7ae45e340b0d8d257bdee001 100644 (file)
@@ -213,6 +213,10 @@ suggest_cb (void *cls,
     // FIXME: stats!
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Suggesting address `%s' of peer `%s'\n",
+              address,
+              GNUNET_i2s (pid));
   env = GNUNET_MQ_msg_extra (as,
                             slen,
                             GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION);
@@ -253,6 +257,12 @@ allocate_cb (void *cls,
        losses of sessions (possibly of previous transport), ignore! */
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Allocating %u/%u bytes for %p of peer `%s'\n",
+              ntohl (bw_in.value__),
+              ntohl (bw_out.value__),
+              session,
+              GNUNET_i2s (peer));
   env = GNUNET_MQ_msg (sam,
                       GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION);
   sam->session_id = session->session_id;
@@ -307,6 +317,11 @@ handle_suggest (void *cls,
     GNUNET_SERVICE_client_drop (c->client);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Client suggested we talk to %s with preference %d at rate %u\n",
+              GNUNET_i2s (&msg->peer),
+              (int) ntohl (msg->pk),
+              (int) ntohl (msg->bw.value__));
   cp = GNUNET_new (struct ClientPreference);
   cp->client = c;
   cp->pref.peer = msg->peer;
@@ -464,6 +479,10 @@ handle_session_add (void *cls,
                                     &session->data,
                                     address);
   GNUNET_assert (NULL != session->sh);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Transport has new session %p to %s\n",
+              session,
+              GNUNET_i2s (&message->peer));
   GNUNET_SERVICE_client_continue (c->client);
 }
 
@@ -540,6 +559,10 @@ handle_session_del (void *cls,
                 GNUNET_CONTAINER_multihashmap32_remove (c->details.transport.sessions,
                                                         session->session_id,
                                                         session));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Transport lost session %p to %s\n",
+              session,
+              GNUNET_i2s (&session->data.peer));
   GNUNET_free (session);
   GNUNET_SERVICE_client_continue (c->client);
 }
index 990eb06707300dbe4c4ea37722e3f1d924b4d88e..5c51e5322b1040bb05884c4282c88777bd251617 100644 (file)
@@ -11,7 +11,7 @@
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Affero General Public License for more details.
-    
+
      You should have received a copy of the GNU Affero General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
  */
 static int ret;
 
-
 /**
  * @brief The time available until the test shuts down
  */
 static struct GNUNET_TIME_Relative timeout;
 
-
 /**
  * @brief ATS Application Handle
  *
@@ -64,6 +62,7 @@ static struct GNUNET_PeerIdentity other_peer;
  */
 static struct GNUNET_ATS_SessionRecord *sr;
 
+
 /**
  * @brief Called whenever allocation changed
  *
@@ -74,7 +73,7 @@ static struct GNUNET_ATS_SessionRecord *sr;
  * @param bandwidth_out
  * @param bandwidth_in
  *
- * @return 
+ * @return
  */
 static void
 allocation_cb (void *cls,
@@ -116,9 +115,9 @@ init_both (const struct GNUNET_CONFIGURATION_Handle *cfg)
   ah = GNUNET_ATS_application_init (cfg);
   GNUNET_assert (NULL != ah);
   th = GNUNET_ATS_transport_init (cfg,
-                                  allocation_cb,
+                                  &allocation_cb,
                                   NULL,
-                                  suggestion_cb,
+                                  &suggestion_cb,
                                   NULL);
   GNUNET_assert (NULL != ah);
 }
@@ -227,7 +226,7 @@ run (void *cls,
  * @param argc
  * @param argv[]
  *
- * @return 
+ * @return
  */
 int
 main (int argc,