-makefile for new test_stream_local (commented)
[oweals/gnunet.git] / src / transport / gnunet-transport-connect-running-peers.c
index aac63cb355dc29092ff84170fba3f71a12b754a1..5a52509205cf2d5de966b7d4edc0dde726916983 100644 (file)
@@ -73,7 +73,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -174,24 +174,23 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
               "Press <q> to quit or <1> to send from p1 to p2, <2> to send from p2 to p1, <enter> repeat\n");
 
 read:
-  t = getchar();
+  t = getchar ();
   if (t == '1')
   {
-    th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0, TIMEOUT,
-                                                 &notify_ready, p1);
+    th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0,
+                                                 TIMEOUT, &notify_ready, p1);
     return;
   }
   if (t == '2')
   {
-    th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0, TIMEOUT,
-                                                 &notify_ready, p2);
+    th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0,
+                                                 TIMEOUT, &notify_ready, p2);
     return;
   }
   if (t == 'q')
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Exiting %c!\n", t);
-    GNUNET_SCHEDULER_add_now(&end, NULL);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Exiting %c!\n", t);
+    GNUNET_SCHEDULER_add_now (&end, NULL);
     return;
   }
   goto read;
@@ -200,8 +199,7 @@ read:
 static void
 notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
                 const struct GNUNET_MessageHeader *message,
-                const struct GNUNET_TRANSPORT_ATS_Information *ats,
-                uint32_t ats_count)
+                const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received message of type %d from peer %s!\n",
@@ -210,8 +208,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   if ((MTYPE == ntohs (message->type)) &&
       (sizeof (struct GNUNET_MessageHeader) == ntohs (message->size)))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Successfully received message\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully received message\n");
 
     send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL);
   }
@@ -219,8 +216,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
 
 static void
 notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_TRANSPORT_ATS_Information *ats,
-                uint32_t ats_count)
+                const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n",
               GNUNET_i2s (peer), cls);
@@ -260,7 +256,7 @@ connect_to_peer (const char *cfgname, GNUNET_TRANSPORT_ReceiveCallback rec,
     GNUNET_DISK_directory_remove (p->servicehome);
   /*
    * p->arm_proc =
-   * GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
+   * GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
    * "gnunet-service-arm", "-c", cfgname,
    * #if VERBOSE_PEERS
    * "-L", "DEBUG",
@@ -290,7 +286,7 @@ static void
 testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
 {
   cc = NULL;
-  char *p1_c = strdup (GNUNET_i2s (&p1->id));
+  char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
 
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers connected: %s <-> %s\n", p1_c,
               GNUNET_i2s (&p2->id));
@@ -324,6 +320,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1, p2, &testing_connect_cb,
                                                NULL);
+
 }
 
 
@@ -371,7 +368,7 @@ main (int argc, char *argv[])
 
   if (argc < 3)
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "usage gnunet-transport-connect-running-peers <cfg_peer1> <cfg_peer2>\n");
     return -1;
   }