aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/gnunet-service-peerstore.c
diff options
context:
space:
mode:
authorOmar Tarabai <tarabai@devegypt.com>2014-05-17 16:57:49 +0000
committerOmar Tarabai <tarabai@devegypt.com>2014-05-17 16:57:49 +0000
commit7eb684ec9f93d52ebae09729fcf01c16580b5cb9 (patch)
tree72a44f01de2dc157f47a0a70ccb90d36154ddcbf /src/peerstore/gnunet-service-peerstore.c
parent83c058a5ea11b6d7aa05cb71963c6063cb373603 (diff)
downloadgnunet-7eb684ec9f93d52ebae09729fcf01c16580b5cb9.tar.gz
gnunet-7eb684ec9f93d52ebae09729fcf01c16580b5cb9.zip
peestore: towards iterate functionality
Diffstat (limited to 'src/peerstore/gnunet-service-peerstore.c')
-rw-r--r--src/peerstore/gnunet-service-peerstore.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c
index 50af4342c..fa674e1ad 100644
--- a/src/peerstore/gnunet-service-peerstore.c
+++ b/src/peerstore/gnunet-service-peerstore.c
@@ -87,28 +87,24 @@ handle_client_disconnect (void *cls,
87 * @param sub_system name of the GNUnet sub system responsible 87 * @param sub_system name of the GNUnet sub system responsible
88 * @param value stored value 88 * @param value stored value
89 * @param size size of stored value 89 * @param size size of stored value
90 * 90 */
91int record_iterator(void *cls, 91int record_iterator(void *cls,
92 const char *sub_system, 92 struct GNUNET_PEERSTORE_Record *record,
93 const struct GNUNET_PeerIdentity *peer, 93 char *emsg)
94 const char *key,
95 const void *value,
96 size_t size,
97 struct GNUNET_TIME_Absolute expiry)
98{ 94{
99 struct GNUNET_SERVER_TransmitContext *tc = cls; 95 struct GNUNET_SERVER_TransmitContext *tc = cls;
100 struct StoreRecordMessage *srm; 96 struct StoreRecordMessage *srm;
101 97
102 srm = PEERSTORE_create_record_message(sub_system, 98 srm = PEERSTORE_create_record_message(record->sub_system,
103 peer, 99 record->peer,
104 key, 100 record->key,
105 value, 101 record->value,
106 size, 102 record->value_size,
107 expiry, 103 record->expiry,
108 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE); 104 GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_RECORD);
109 GNUNET_SERVER_transmit_context_append_message(tc, (const struct GNUNET_MessageHeader *)srm); 105 GNUNET_SERVER_transmit_context_append_message(tc, (const struct GNUNET_MessageHeader *)srm);
110 return GNUNET_YES; 106 return GNUNET_YES;
111}*/ 107}
112 108
113/** 109/**
114 * Handle an iterate request from client 110 * Handle an iterate request from client
@@ -116,7 +112,7 @@ int record_iterator(void *cls,
116 * @param cls unused 112 * @param cls unused
117 * @param client identification of the client 113 * @param client identification of the client
118 * @param message the actual message 114 * @param message the actual message
119 * 115 */
120void handle_iterate (void *cls, 116void handle_iterate (void *cls,
121 struct GNUNET_SERVER_Client *client, 117 struct GNUNET_SERVER_Client *client,
122 const struct GNUNET_MessageHeader *message) 118 const struct GNUNET_MessageHeader *message)
@@ -145,9 +141,16 @@ void handle_iterate (void *cls,
145 &record_iterator, 141 &record_iterator,
146 tc)) 142 tc))
147 { 143 {
148 144 GNUNET_SERVER_transmit_context_append_data(tc, NULL, 0, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END);
145 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
149 } 146 }
150}*/ 147 else
148 {
149 GNUNET_free(tc);
150 GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
151 }
152 GNUNET_free(record);
153}
151 154
152/** 155/**
153 * Handle a store request from client 156 * Handle a store request from client
@@ -220,7 +223,7 @@ run (void *cls,
220{ 223{
221 static const struct GNUNET_SERVER_MessageHandler handlers[] = { 224 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
222 {&handle_store, NULL, GNUNET_MESSAGE_TYPE_PEERSTORE_STORE, 0}, 225 {&handle_store, NULL, GNUNET_MESSAGE_TYPE_PEERSTORE_STORE, 0},
223// {&handle_iterate, NULL, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE, 0}, 226 {&handle_iterate, NULL, GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE, 0},
224 {NULL, NULL, 0, 0} 227 {NULL, NULL, 0, 0}
225 }; 228 };
226 char *database; 229 char *database;