[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33500 - in gnunet/src: peerstore sensor
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33500 - in gnunet/src: peerstore sensor |
Date: |
Tue, 3 Jun 2014 19:17:43 +0200 |
Author: otarabai
Date: 2014-06-03 19:17:42 +0200 (Tue, 03 Jun 2014)
New Revision: 33500
Modified:
gnunet/src/peerstore/gnunet-service-peerstore.c
gnunet/src/peerstore/peerstore_api.c
gnunet/src/sensor/gnunet-sensor.c
Log:
minor fixes
Modified: gnunet/src/peerstore/gnunet-service-peerstore.c
===================================================================
--- gnunet/src/peerstore/gnunet-service-peerstore.c 2014-06-03 15:03:36 UTC
(rev 33499)
+++ gnunet/src/peerstore/gnunet-service-peerstore.c 2014-06-03 17:17:42 UTC
(rev 33500)
@@ -117,6 +117,22 @@
&cleanup_expired_records, NULL);
}
+/**
+ * Search for a disconnected client and remove it
+ *
+ * @param cls closuer, a 'struct GNUNET_PEERSTORE_Record *'
+ * @param key hash of record key
+ * @param value the watcher client, a 'struct GNUNET_SERVER_Client *'
+ * @return #GNUNET_YES to continue iterating
+ */
+int client_disconnect_it(void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
+{
+ if(cls == value)
+ GNUNET_CONTAINER_multihashmap_remove(watchers, key, value);
+ return GNUNET_YES;
+}
/**
* A client disconnected. Remove all of its data structure entries.
@@ -129,6 +145,9 @@
struct GNUNET_SERVER_Client
* client)
{
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "A client was disconnected, cleaning
up.\n");
+ GNUNET_CONTAINER_multihashmap_iterate(watchers,
+ &client_disconnect_it, client);
}
/**
@@ -177,9 +196,10 @@
struct StoreRecordMessage *srm;
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Found a watcher to update.\n");
- if(NULL == value)
+ if(NULL == client)
{
- GNUNET_CONTAINER_multihashmap_remove(watchers, key, value);
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Removing a dead client.\n");
+ GNUNET_CONTAINER_multihashmap_remove(watchers, key, client);
return GNUNET_YES;
}
srm = PEERSTORE_create_record_message(record->sub_system,
Modified: gnunet/src/peerstore/peerstore_api.c
===================================================================
--- gnunet/src/peerstore/peerstore_api.c 2014-06-03 15:03:36 UTC (rev
33499)
+++ gnunet/src/peerstore/peerstore_api.c 2014-06-03 17:17:42 UTC (rev
33500)
@@ -488,6 +488,7 @@
msg_type = ntohs(msg->type);
if(GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END == msg_type)
{
+ ic->request_sent = GNUNET_NO;
GNUNET_PEERSTORE_iterate_cancel(ic);
if(NULL != callback)
callback(callback_cls, NULL, NULL);
@@ -497,9 +498,12 @@
{
record = PEERSTORE_parse_record_message(msg);
if(NULL == record)
- continue_iter = callback(callback_cls, record, _("Received a malformed
response from service."));
+ continue_iter = callback(callback_cls, NULL, _("Received a malformed
response from service."));
else
+ {
continue_iter = callback(callback_cls, record, NULL);
+ PEERSTORE_destroy_record(record);
+ }
if(GNUNET_NO == continue_iter)
ic->callback = NULL;
}
@@ -638,7 +642,7 @@
wc = GNUNET_CONTAINER_multihashmap_get(h->watches, &keyhash);
if(NULL != wc->callback)
wc->callback(wc->callback_cls, record, NULL);
- /* TODO: destroy record */
+ PEERSTORE_destroy_record(record);
}
/**
Modified: gnunet/src/sensor/gnunet-sensor.c
===================================================================
--- gnunet/src/sensor/gnunet-sensor.c 2014-06-03 15:03:36 UTC (rev 33499)
+++ gnunet/src/sensor/gnunet-sensor.c 2014-06-03 17:17:42 UTC (rev 33500)
@@ -79,10 +79,7 @@
return;
}
if(NULL == sensor) /* no more sensors from service */
- {
- GNUNET_SCHEDULER_shutdown();
return;
- }
printf("Name: %s\nVersion: %d.%d\n",
sensor->name,
sensor->version_major,
@@ -132,6 +129,7 @@
NULL);
}
+ GNUNET_SCHEDULER_shutdown();
ret = 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33500 - in gnunet/src: peerstore sensor,
gnunet <=