gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23989 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r23989 - gnunet/src/testbed
Date: Tue, 25 Sep 2012 13:44:58 +0200

Author: harsha
Date: 2012-09-25 13:44:58 +0200 (Tue, 25 Sep 2012)
New Revision: 23989

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
Log:
overlay connect forwarding when peer1 is not local

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-09-25 08:58:34 UTC (rev 
23988)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-09-25 11:44:58 UTC (rev 
23989)
@@ -2001,6 +2001,7 @@
   LOG_DEBUG ("Cleaning up occ\n");
   GNUNET_free_non_null (occ->emsg);
   GNUNET_free_non_null (occ->hello);
+  GNUNET_SERVER_client_drop (occ->client);
   if (NULL != occ->opc)
     GNUNET_TESTBED_forward_operation_msg_cancel_ (occ->opc);
   if (GNUNET_SCHEDULER_NO_TASK != occ->send_hello_task)
@@ -2031,7 +2032,6 @@
 
   occ->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   send_operation_fail_msg (occ->client, occ->op_id, occ->emsg);
-  GNUNET_SERVER_client_drop (occ->client);
   occ_cleanup (occ, tc);
 }
 
@@ -2100,7 +2100,6 @@
   msg->peer2 = htonl (occ->other_peer->id);
   msg->operation_id = GNUNET_htonll (occ->op_id);
   queue_message (occ->client, &msg->header);
-  GNUNET_SERVER_client_drop (occ->client);
   GNUNET_SCHEDULER_add_now (&occ_cleanup, occ);
 }
 
@@ -2333,6 +2332,8 @@
   const struct GNUNET_CORE_MessageHandler no_handlers[] = {
     {NULL, 0, 0}
   };
+  struct Peer *peer;
+  uint64_t operation_id;
   uint32_t p1;
   uint32_t p2;
 
@@ -2341,11 +2342,27 @@
   p2 = ntohl (msg->peer2);
   GNUNET_assert (p1 < peer_list_size);
   GNUNET_assert (NULL != peer_list[p1]);
-  GNUNET_assert (p2 < peer_list_size);
-  GNUNET_assert (NULL != peer_list[p2]);
-  /* FIXME: Add cases where we have to forward overlay connect message to sub
-   * controllers */
-  GNUNET_assert (GNUNET_NO == peer_list[p1]->is_remote);
+  peer = peer_list[p1];
+  operation_id = GNUNET_ntohll (msg->operation_id);
+  if (GNUNET_YES == peer->is_remote)
+  {
+    struct ForwardedOperationContext *fopc;
+
+    fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+    GNUNET_SERVER_client_keep (client);
+    fopc->client = client;
+    fopc->operation_id = operation_id;
+    fopc->opc = 
+       GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+                                              operation_id, message,
+                                              &forwarded_operation_reply_relay,
+                                              fopc);
+    fopc->timeout_task =
+       GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+                                     fopc);
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
+    return;
+  }
   occ = GNUNET_malloc (sizeof (struct OverlayConnectContext));
   GNUNET_SERVER_client_keep (client);
   occ->client = client;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]