aboutsummaryrefslogtreecommitdiff
path: root/src/psyc/psyc_api.c
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2015-08-28 13:33:43 +0000
committerGabor X Toth <*@tg-x.net>2015-08-28 13:33:43 +0000
commit38963d1e81332032e0ac774f4f2c6b804c38802a (patch)
treece33b979e47fe332c7c744744d60077a7e1fefee /src/psyc/psyc_api.c
parentb4fa14499c64140273850569247abda687803053 (diff)
downloadgnunet-38963d1e81332032e0ac774f4f2c6b804c38802a.tar.gz
gnunet-38963d1e81332032e0ac774f4f2c6b804c38802a.zip
psyc/social: get state from psycstore
Diffstat (limited to 'src/psyc/psyc_api.c')
-rw-r--r--src/psyc/psyc_api.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c
index 5fc5391a0..b862eee9c 100644
--- a/src/psyc/psyc_api.c
+++ b/src/psyc/psyc_api.c
@@ -366,34 +366,36 @@ channel_recv_state_result (void *cls,
366 } 366 }
367 367
368 const struct GNUNET_MessageHeader * 368 const struct GNUNET_MessageHeader *
369 modc = (struct GNUNET_MessageHeader *) &res[1]; 369 mod = (struct GNUNET_MessageHeader *) &res[1];
370 uint16_t modc_size = ntohs (modc->size); 370 uint16_t mod_size = ntohs (mod->size);
371 if (ntohs (msg->size) - sizeof (*msg) != modc_size) 371 if (ntohs (msg->size) - sizeof (*res) != mod_size)
372 { 372 {
373 GNUNET_break (0); 373 GNUNET_break (0);
374 return; 374 return;
375 } 375 }
376 switch (ntohs (modc->type)) 376 switch (ntohs (mod->type))
377 { 377 {
378 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER: 378 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER:
379 { 379 {
380 const struct GNUNET_PSYC_MessageModifier * 380 const struct GNUNET_PSYC_MessageModifier *
381 mod = (const struct GNUNET_PSYC_MessageModifier *) modc; 381 pmod = (const struct GNUNET_PSYC_MessageModifier *) mod;
382 382
383 const char *name = (const char *) &mod[1]; 383 const char *name = (const char *) &pmod[1];
384 uint16_t name_size = ntohs (mod->name_size); 384 uint16_t name_size = ntohs (pmod->name_size);
385 if ('\0' != name[name_size - 1]) 385 if ('\0' != name[name_size - 1])
386 { 386 {
387 GNUNET_break (0); 387 GNUNET_break (0);
388 return; 388 return;
389 } 389 }
390 sr->var_cb (sr->cls, name, name + name_size, ntohs (mod->value_size)); 390 sr->var_cb (sr->cls, mod, name, name + name_size,
391 ntohs (pmod->header.size) - sizeof (*pmod),
392 ntohs (pmod->value_size));
391 break; 393 break;
392 } 394 }
393 395
394 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT: 396 case GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT:
395 sr->var_cb (sr->cls, NULL, (const char *) &modc[1], 397 sr->var_cb (sr->cls, mod, NULL, (const char *) &mod[1],
396 modc_size - sizeof (*modc)); 398 mod_size - sizeof (*mod), 0);
397 break; 399 break;
398 } 400 }
399} 401}