[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25939 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25939 - gnunet/src/testbed |
Date: |
Wed, 30 Jan 2013 11:41:18 +0100 |
Author: harsha
Date: 2013-01-30 11:41:18 +0100 (Wed, 30 Jan 2013)
New Revision: 25939
Modified:
gnunet/src/testbed/gnunet-service-testbed_hc.c
gnunet/src/testbed/gnunet-service-testbed_oc.c
Log:
- fixes
Modified: gnunet/src/testbed/gnunet-service-testbed_hc.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_hc.c 2013-01-30 10:06:33 UTC
(rev 25938)
+++ gnunet/src/testbed/gnunet-service-testbed_hc.c 2013-01-30 10:41:18 UTC
(rev 25939)
@@ -26,39 +26,19 @@
#include "gnunet-service-testbed.h"
-
+/**
+ * Redefine LOG with a changed log component string
+ */
#ifdef LOG
#undef LOG
#endif
-
#define LOG(kind,...) \
GNUNET_log_from (kind, "testbed-cache", __VA_ARGS__)
-enum CacheGetType
-{
- CGT_TRANSPORT_HANDLE = 1
-};
+struct GSTCacheGetHandle;
-struct GSTCacheGetHandle
-{
- struct GSTCacheGetHandle *next;
-
- struct GSTCacheGetHandle *prev;
-
- struct CacheEntry *entry;
-
- GST_cache_callback cb;
-
- void *cb_cls;
-
- enum CacheGetType type;
-
- int notify_called;
-};
-
-
/**
* This context structure is used to maintain a queue of notifications to check
* which of them are to be notified when a peer is connected.
@@ -90,8 +70,39 @@
* The closure for the notify callback
*/
void *cb_cls;
+
+ /**
+ * The GSTCacheGetHandle reposible for creating this context
+ */
+ struct GSTCacheGetHandle *cgh;
};
+
+enum CacheGetType
+{
+ CGT_TRANSPORT_HANDLE = 1
+};
+
+
+struct GSTCacheGetHandle
+{
+ struct GSTCacheGetHandle *next;
+
+ struct GSTCacheGetHandle *prev;
+
+ struct CacheEntry *entry;
+
+ GST_cache_callback cb;
+
+ void *cb_cls;
+
+ struct ConnectNotifyContext *nctxt;
+
+ enum CacheGetType type;
+
+ int notify_called;
+};
+
/**
* Cache entry
*/
@@ -325,7 +336,8 @@
GST_cache_peer_connect_notify cb;
void *cb_cls;
- while (NULL != (ctxt = entry->nctxt_qhead))
+
+ for (ctxt=entry->nctxt_qhead; NULL != ctxt; ctxt=ctxt->next)
{
if (0 == memcmp (ctxt->target, peer, sizeof (struct GNUNET_PeerIdentity)))
break;
@@ -334,6 +346,8 @@
return;
cb = ctxt->cb;
cb_cls = ctxt->cb_cls;
+ GNUNET_assert (NULL != ctxt->cgh);
+ ctxt->cgh->nctxt = NULL;
GNUNET_CONTAINER_DLL_remove (entry->nctxt_qhead, entry->nctxt_qtail, ctxt);
GNUNET_free (ctxt);
cb (cb_cls, peer);
@@ -426,6 +440,9 @@
ctxt->target = target;
ctxt->cb = connect_notify_cb;
ctxt->cb_cls = connect_notify_cb_cls;
+ GNUNET_assert (NULL == cgh->nctxt);
+ cgh->nctxt = ctxt;
+ ctxt->cgh = cgh;
GNUNET_CONTAINER_DLL_insert_tail (entry->nctxt_qhead, entry->nctxt_qtail,
ctxt);
}
if ((NULL != entry->transport_handle) || (NULL != entry->transport_op))
@@ -534,6 +551,13 @@
entry->notify_task = GNUNET_SCHEDULER_NO_TASK;
}
GNUNET_CONTAINER_DLL_remove (entry->cgh_qhead, entry->cgh_qtail, cgh);
+ if (NULL != cgh->nctxt)
+ {
+ GNUNET_assert (cgh == cgh->nctxt->cgh);
+ GNUNET_CONTAINER_DLL_remove (entry->nctxt_qhead, entry->nctxt_qtail,
cgh->nctxt);
+ GNUNET_free (cgh->nctxt);
+ }
+
if (0 == entry->demand)
{
GNUNET_CONTAINER_DLL_insert_tail (lru_cache_head, lru_cache_tail, entry);
Modified: gnunet/src/testbed/gnunet-service-testbed_oc.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_oc.c 2013-01-30 10:06:33 UTC
(rev 25938)
+++ gnunet/src/testbed/gnunet-service-testbed_oc.c 2013-01-30 10:41:18 UTC
(rev 25939)
@@ -25,9 +25,17 @@
*/
#include "gnunet-service-testbed.h"
-#include "testbed_api_operations.h"
+/**
+ * Redefine LOG with a changed log component string
+ */
+#ifdef LOG
+#undef LOG
+#endif
+#define LOG(kind,...) \
+ GNUNET_log_from (kind, "testbed-OC", __VA_ARGS__)
+
/**
* Context information for transport try connect
*/
@@ -1468,6 +1476,14 @@
}
rocc->tcc.th_ = th;
rocc->tcc.pid = &rocc->a_id;
+ if (GNUNET_YES == GNUNET_TRANSPORT_check_neighbour_connected (rocc->tcc.th_,
+ rocc->tcc.pid))
+ {
+ LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n",
+ rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id);
+ cleanup_rocc (rocc);
+ return;
+ }
rocc->attempt_connect_task_id =
GNUNET_SCHEDULER_add_now (&attempt_connect_task, rocc);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25939 - gnunet/src/testbed,
gnunet <=