-makefile for new test_stream_local (commented)
[oweals/gnunet.git] / src / transport / transport_api.c
index 2ececc10da107a7822d48f45c9bbd80a2268d37c..9ff5cec88ff5a2bf97ed2bc883c7e22fdeb71e27 100644 (file)
@@ -473,7 +473,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
       GNUNET_break (0);
       break;
     }
-    ats = (const struct GNUNET_ATS_Information*) &cim[1];
+    ats = (const struct GNUNET_ATS_Information *) &cim[1];
 #if DEBUG_TRANSPORT_API
     LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
          "CONNECT", GNUNET_i2s (&cim->id));
@@ -547,7 +547,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
     }
     im = (const struct InboundMessage *) msg;
     ats_count = ntohl (im->ats_count);
-    ats = (const struct GNUNET_ATS_Information*) &im[1];
+    ats = (const struct GNUNET_ATS_Information *) &im[1];
     imm = (const struct GNUNET_MessageHeader *) &ats[ats_count];
     if (ntohs (imm->size) + sizeof (struct InboundMessage) +
         ats_count * sizeof (struct GNUNET_ATS_Information) != size)
@@ -861,6 +861,7 @@ send_start (void *cls, size_t size, void *buf)
 {
   struct GNUNET_TRANSPORT_Handle *h = cls;
   struct StartMessage s;
+  uint32_t options;
 
   if (buf == NULL)
   {
@@ -877,7 +878,12 @@ send_start (void *cls, size_t size, void *buf)
   GNUNET_assert (size >= sizeof (struct StartMessage));
   s.header.size = htons (sizeof (struct StartMessage));
   s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
-  s.do_check = htonl (h->check_self);
+  options = 0;
+  if (h->check_self)
+    options |= 1;
+  if (h->rec != NULL)
+    options |= 2;
+  s.options = htonl (options);
   s.self = h->self;
   memcpy (buf, &s, sizeof (struct StartMessage));
   GNUNET_CLIENT_receive (h->client, &demultiplexer, h,
@@ -927,8 +933,6 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
   struct GNUNET_TRANSPORT_TransmitHandle *th;
 
   GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK);
-  /* Forget about all neighbours that we used to be connected to */
-  GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
   if (NULL != h->cth)
   {
     GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
@@ -939,6 +943,8 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
     GNUNET_CLIENT_disconnect (h->client, GNUNET_YES);
     h->client = NULL;
   }
+  /* Forget about all neighbours that we used to be connected to */
+  GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
   if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (h->quota_task);