diff options
Diffstat (limited to 'src/social/social_api.c')
-rw-r--r-- | src/social/social_api.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/social/social_api.c b/src/social/social_api.c index c23987145..bcd263d03 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -398,21 +398,18 @@ nym_destroy (struct GNUNET_SOCIAL_Nym *nym) | |||
398 | 398 | ||
399 | static void | 399 | static void |
400 | host_recv_notice_place_leave_method (void *cls, | 400 | host_recv_notice_place_leave_method (void *cls, |
401 | const struct GNUNET_PSYC_MessageHeader *msg, | ||
401 | const struct GNUNET_PSYC_MessageMethod *meth, | 402 | const struct GNUNET_PSYC_MessageMethod *meth, |
402 | uint64_t message_id, | 403 | uint64_t message_id, |
403 | uint32_t flags, | ||
404 | uint64_t fragment_offset, | ||
405 | uint32_t tmit_flags, | ||
406 | const struct GNUNET_CRYPTO_EcdsaPublicKey *nym_pub_key, | ||
407 | const char *method_name) | 404 | const char *method_name) |
408 | { | 405 | { |
409 | struct GNUNET_SOCIAL_Host *hst = cls; | 406 | struct GNUNET_SOCIAL_Host *hst = cls; |
410 | 407 | ||
411 | if (0 == memcmp (&(struct GNUNET_CRYPTO_EcdsaPublicKey) {}, | 408 | if (0 == memcmp (&(struct GNUNET_CRYPTO_EcdsaPublicKey) {}, |
412 | nym_pub_key, sizeof (*nym_pub_key))) | 409 | &msg->slave_pub_key, sizeof (msg->slave_pub_key))) |
413 | return; | 410 | return; |
414 | 411 | ||
415 | struct GNUNET_SOCIAL_Nym *nym = nym_get_or_create (nym_pub_key); | 412 | struct GNUNET_SOCIAL_Nym *nym = nym_get_or_create (&msg->slave_pub_key); |
416 | 413 | ||
417 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 414 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
418 | "Host received method for message ID %" PRIu64 " from nym %s: %s\n", | 415 | "Host received method for message ID %" PRIu64 " from nym %s: %s\n", |
@@ -430,10 +427,9 @@ host_recv_notice_place_leave_method (void *cls, | |||
430 | 427 | ||
431 | static void | 428 | static void |
432 | host_recv_notice_place_leave_modifier (void *cls, | 429 | host_recv_notice_place_leave_modifier (void *cls, |
433 | const struct GNUNET_MessageHeader *msg, | 430 | const struct GNUNET_PSYC_MessageHeader *msg, |
431 | const struct GNUNET_MessageHeader *pmsg, | ||
434 | uint64_t message_id, | 432 | uint64_t message_id, |
435 | uint32_t flags, | ||
436 | uint64_t fragment_offset, | ||
437 | enum GNUNET_PSYC_Operator oper, | 433 | enum GNUNET_PSYC_Operator oper, |
438 | const char *name, | 434 | const char *name, |
439 | const void *value, | 435 | const void *value, |
@@ -461,11 +457,10 @@ host_recv_notice_place_leave_modifier (void *cls, | |||
461 | 457 | ||
462 | static void | 458 | static void |
463 | host_recv_notice_place_leave_eom (void *cls, | 459 | host_recv_notice_place_leave_eom (void *cls, |
464 | const struct GNUNET_MessageHeader *msg, | 460 | const struct GNUNET_PSYC_MessageHeader *msg, |
461 | const struct GNUNET_MessageHeader *pmsg, | ||
465 | uint64_t message_id, | 462 | uint64_t message_id, |
466 | uint32_t flags, | 463 | uint8_t is_cancelled) |
467 | uint64_t fragment_offset, | ||
468 | uint8_t cancelled) | ||
469 | { | 464 | { |
470 | struct GNUNET_SOCIAL_Host *hst = cls; | 465 | struct GNUNET_SOCIAL_Host *hst = cls; |
471 | if (NULL == hst->notice_place_leave_env) | 466 | if (NULL == hst->notice_place_leave_env) |
@@ -476,7 +471,7 @@ host_recv_notice_place_leave_eom (void *cls, | |||
476 | "_notice_place_leave: got EOM from nym %s (%s).\n", | 471 | "_notice_place_leave: got EOM from nym %s (%s).\n", |
477 | GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); | 472 | GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); |
478 | 473 | ||
479 | if (GNUNET_YES != cancelled) | 474 | if (GNUNET_YES != is_cancelled) |
480 | { | 475 | { |
481 | if (NULL != hst->farewell_cb) | 476 | if (NULL != hst->farewell_cb) |
482 | hst->farewell_cb (hst->cb_cls, hst->notice_place_leave_nym, | 477 | hst->farewell_cb (hst->cb_cls, hst->notice_place_leave_nym, |
@@ -1059,7 +1054,6 @@ static struct GNUNET_CLIENT_MANAGER_MessageHandler guest_handlers[] = | |||
1059 | }; | 1054 | }; |
1060 | 1055 | ||
1061 | 1056 | ||
1062 | |||
1063 | static struct GNUNET_CLIENT_MANAGER_MessageHandler app_handlers[] = | 1057 | static struct GNUNET_CLIENT_MANAGER_MessageHandler app_handlers[] = |
1064 | { | 1058 | { |
1065 | { app_recv_ego, NULL, | 1059 | { app_recv_ego, NULL, |
@@ -1083,6 +1077,13 @@ static struct GNUNET_CLIENT_MANAGER_MessageHandler app_handlers[] = | |||
1083 | static void | 1077 | static void |
1084 | place_cleanup (struct GNUNET_SOCIAL_Place *plc) | 1078 | place_cleanup (struct GNUNET_SOCIAL_Place *plc) |
1085 | { | 1079 | { |
1080 | struct GNUNET_HashCode place_pub_hash; | ||
1081 | GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash); | ||
1082 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1083 | "%s place cleanup: %s\n", | ||
1084 | GNUNET_YES == plc->is_host ? "host" : "guest", | ||
1085 | GNUNET_h2s (&place_pub_hash)); | ||
1086 | |||
1086 | if (NULL != plc->tmit) | 1087 | if (NULL != plc->tmit) |
1087 | GNUNET_PSYC_transmit_destroy (plc->tmit); | 1088 | GNUNET_PSYC_transmit_destroy (plc->tmit); |
1088 | if (NULL != plc->connect_msg) | 1089 | if (NULL != plc->connect_msg) |
@@ -1173,7 +1174,7 @@ GNUNET_SOCIAL_host_enter (const struct GNUNET_SOCIAL_App *app, | |||
1173 | plc->tmit = GNUNET_PSYC_transmit_create (plc->client); | 1174 | plc->tmit = GNUNET_PSYC_transmit_create (plc->client); |
1174 | 1175 | ||
1175 | hst->slicer = GNUNET_PSYC_slicer_create (); | 1176 | hst->slicer = GNUNET_PSYC_slicer_create (); |
1176 | GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave", | 1177 | GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave", NULL, |
1177 | host_recv_notice_place_leave_method, | 1178 | host_recv_notice_place_leave_method, |
1178 | host_recv_notice_place_leave_modifier, | 1179 | host_recv_notice_place_leave_modifier, |
1179 | NULL, host_recv_notice_place_leave_eom, hst); | 1180 | NULL, host_recv_notice_place_leave_eom, hst); |
@@ -1243,7 +1244,7 @@ GNUNET_SOCIAL_host_enter_reconnect (struct GNUNET_SOCIAL_HostConnection *hconn, | |||
1243 | plc->tmit = GNUNET_PSYC_transmit_create (plc->client); | 1244 | plc->tmit = GNUNET_PSYC_transmit_create (plc->client); |
1244 | 1245 | ||
1245 | hst->slicer = GNUNET_PSYC_slicer_create (); | 1246 | hst->slicer = GNUNET_PSYC_slicer_create (); |
1246 | GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave", | 1247 | GNUNET_PSYC_slicer_method_add (hst->slicer, "_notice_place_leave", NULL, |
1247 | host_recv_notice_place_leave_method, | 1248 | host_recv_notice_place_leave_method, |
1248 | host_recv_notice_place_leave_modifier, | 1249 | host_recv_notice_place_leave_modifier, |
1249 | NULL, host_recv_notice_place_leave_eom, hst); | 1250 | NULL, host_recv_notice_place_leave_eom, hst); |
@@ -1492,7 +1493,6 @@ GNUNET_SOCIAL_host_get_place (struct GNUNET_SOCIAL_Host *hst) | |||
1492 | } | 1493 | } |
1493 | 1494 | ||
1494 | 1495 | ||
1495 | |||
1496 | void | 1496 | void |
1497 | place_leave (struct GNUNET_SOCIAL_Place *plc) | 1497 | place_leave (struct GNUNET_SOCIAL_Place *plc) |
1498 | { | 1498 | { |
@@ -1656,7 +1656,7 @@ GNUNET_SOCIAL_guest_enter (const struct GNUNET_SOCIAL_App *app, | |||
1656 | plc->ego_pub_key = ego->pub_key; | 1656 | plc->ego_pub_key = ego->pub_key; |
1657 | plc->pub_key = *place_pub_key; | 1657 | plc->pub_key = *place_pub_key; |
1658 | plc->cfg = app->cfg; | 1658 | plc->cfg = app->cfg; |
1659 | plc->is_host = GNUNET_YES; | 1659 | plc->is_host = GNUNET_NO; |
1660 | plc->slicer = slicer; | 1660 | plc->slicer = slicer; |
1661 | 1661 | ||
1662 | gst->enter_cb = local_enter_cb; | 1662 | gst->enter_cb = local_enter_cb; |
@@ -2335,7 +2335,6 @@ GNUNET_SOCIAL_zone_add_place (const struct GNUNET_SOCIAL_App *app, | |||
2335 | op_recv_zone_add_place_result, | 2335 | op_recv_zone_add_place_result, |
2336 | add_plc)); | 2336 | add_plc)); |
2337 | GNUNET_CLIENT_MANAGER_transmit_now (app->client, &preq->header); | 2337 | GNUNET_CLIENT_MANAGER_transmit_now (app->client, &preq->header); |
2338 | GNUNET_free (preq); | ||
2339 | return GNUNET_OK; | 2338 | return GNUNET_OK; |
2340 | } | 2339 | } |
2341 | 2340 | ||