[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23807 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23807 - gnunet/src/testbed |
Date: |
Fri, 14 Sep 2012 16:05:35 +0200 |
Author: harsha
Date: 2012-09-14 16:05:35 +0200 (Fri, 14 Sep 2012)
New Revision: 23807
Modified:
gnunet/src/testbed/gnunet-service-testbed.c
gnunet/src/testbed/testbed.h
Log:
unstable checkpoint save
Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-09-14 14:00:48 UTC (rev
23806)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-09-14 14:05:35 UTC (rev
23807)
@@ -316,7 +316,7 @@
} details;
/**
- * Is this peer local created?
+ * Is this peer locally created?
*/
int is_remote;
@@ -1950,6 +1950,7 @@
{
struct OverlayConnectContext *occ = cls;
+ LOG_DEBUG ("Cleaning up occ\n");
GNUNET_free_non_null (occ->emsg);
GNUNET_free_non_null (occ->hello);
if (GNUNET_SCHEDULER_NO_TASK != occ->send_hello_task)
@@ -2016,8 +2017,8 @@
memcmp (new_peer, &occ->other_peer_identity,
sizeof (struct GNUNET_PeerIdentity)))
{
- LOG_DEBUG ("Unexpected peer %4s connected to peer %4s\n", new_peer_str,
- other_peer_str);
+ LOG_DEBUG ("Unexpected peer %4s connected when expecting peer %4s\n",
+ new_peer_str, other_peer_str);
GNUNET_free (new_peer_str);
GNUNET_free (other_peer_str);
return;
@@ -2036,7 +2037,8 @@
occ->timeout_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_free_non_null (occ->emsg);
occ->emsg = NULL;
- GNUNET_TRANSPORT_disconnect (occ->p2th);
+ if (NULL != occ->p2th)
+ GNUNET_TRANSPORT_disconnect (occ->p2th);
occ->p2th = NULL;
LOG_DEBUG ("Peers connected - Sending overlay connect success\n");
msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
@@ -2070,12 +2072,34 @@
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (NULL != occ->hello);
- other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
- LOG_DEBUG ("Offering HELLO of %s to %s\n",
- GNUNET_i2s (&occ->peer_identity), other_peer_str);
- GNUNET_free (other_peer_str);
- GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL);
- GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity);
+ if (GNUNET_YES == occ->other_peer->is_remote)
+ {
+ struct GNUNET_TESTBED_RequestConnectMessage *msg;
+ uint16_t msize;
+ uint16_t hello_size;
+
+ hello_size = ntohs (occ->hello->size);
+ msize = sizeof (struct GNUNET_TESTBED_RequestConnectMessage) + hello_size;
+ msg = GNUNET_malloc (msize);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT);
+ msg->header.size = htons (msize);
+ msg->peer = htonl (occ->peer->id);
+ msg->operation_id = GNUNET_htonll (occ->op_id);
+ (void) memcpy (&msg->peer_identity, &occ->peer_identity,
+ sizeof (struct GNUNET_PeerIdentity));
+ memcpy (msg->hello, occ->hello, hello_size);
+ GNUNET_TESTBED_queue_message_ (occ->other_peer->details.remote.controller,
+ &msg->header);
+ }
+ else
+ {
+ other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
+ LOG_DEBUG ("Offering HELLO of %s to %s\n",
+ GNUNET_i2s (&occ->peer_identity), other_peer_str);
+ GNUNET_free (other_peer_str);
+ GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL);
+ GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity);
+ }
occ->send_hello_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &send_hello,
occ);
}
@@ -2131,6 +2155,20 @@
GNUNET_TRANSPORT_disconnect (occ->p1th);
occ->p1th = NULL;
GNUNET_free_non_null (occ->emsg);
+ if (GNUNET_NO == occ->other_peer->is_remote)
+ {
+ occ->p2th =
+ GNUNET_TRANSPORT_connect (occ->other_peer->details.local.cfg,
+ &occ->other_peer_identity, NULL, NULL, NULL,
+ NULL);
+ if (NULL == occ->p2th)
+ {
+ occ->emsg = GNUNET_strdup ("Cannot connect to TRANSPORT of peer B");
+ GNUNET_SCHEDULER_cancel (occ->timeout_task);
+ occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect,
occ);
+ return;
+ }
+ }
occ->emsg = GNUNET_strdup ("Timeout while offering HELLO to other peer");
occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
}
@@ -2164,16 +2202,10 @@
occ->p1th =
GNUNET_TRANSPORT_connect (occ->peer->details.local.cfg,
&occ->peer_identity, NULL, NULL, NULL, NULL);
- /* Connect to the transport of 2nd peer to offer 1st peer's HELLO */
- GNUNET_TESTING_peer_get_identity (occ->other_peer->details.local.peer,
- &occ->other_peer_identity);
- occ->p2th =
- GNUNET_TRANSPORT_connect (occ->other_peer->details.local.cfg,
- &occ->other_peer_identity, NULL, NULL, NULL,
- NULL);
- if ((NULL == occ->p1th) || (NULL == occ->p2th))
+ if (NULL == occ->p1th)
{
- occ->emsg = GNUNET_strdup ("Cannot connect to TRANSPORTs of peers");
+ GNUNET_asprintf (&occ->emsg, "Cannot connect to TRANSPORT of peers %4s",
+ GNUNET_i2s (&occ->peer_identity));
goto error_return;
}
LOG_DEBUG ("Acquiring HELLO of peer %s\n", GNUNET_i2s (&occ->peer_identity));
@@ -2184,6 +2216,7 @@
error_return:
GNUNET_SCHEDULER_cancel (occ->timeout_task);
occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
+ return;
}
@@ -2222,6 +2255,9 @@
occ->peer = peer_list[p1];
occ->other_peer = peer_list[p2];
occ->op_id = GNUNET_ntohll (msg->operation_id);
+ /* Get the identity of the second peer */
+ GNUNET_TESTING_peer_get_identity (occ->other_peer->details.local.peer,
+ &occ->other_peer_identity);
/* Connect to the core of 1st peer and wait for the 2nd peer to connect */
occ->emsg = GNUNET_strdup ("Timeout while connecting to CORE");
occ->ch =
Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h 2012-09-14 14:00:48 UTC (rev 23806)
+++ gnunet/src/testbed/testbed.h 2012-09-14 14:05:35 UTC (rev 23807)
@@ -419,7 +419,12 @@
/**
* The Operation ID that is used to identify this operation
*/
- uint64_t operation_id GNUNET_PACKED;
+ uint64_t operation_id GNUNET_PACKED;
+
+ /**
+ * Identity of A
+ */
+ struct GNUNET_PeerIdentity peer_identity;
/**
* To be followed by the HELLO message of A
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23807 - gnunet/src/testbed,
gnunet <=