aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2017-10-13 19:25:45 +0200
committerlurchi <lurchi@strangeplace.net>2017-10-13 19:25:45 +0200
commit6d067bc953382bc09712810604747b3ea37b97ec (patch)
tree92ad9ee6e54f2001678d40a4aa3e093030be5677 /src/social
parent56ddece0edfd7d5a6fa01bc1eb2a51dd8c317ee8 (diff)
downloadgnunet-6d067bc953382bc09712810604747b3ea37b97ec.tar.gz
gnunet-6d067bc953382bc09712810604747b3ea37b97ec.zip
trying to fix test_social and social service with a lot of debug outputs
Diffstat (limited to 'src/social')
-rw-r--r--src/social/gnunet-service-social.c370
-rw-r--r--src/social/social_api.c36
-rw-r--r--src/social/test_social.c131
3 files changed, 314 insertions, 223 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index dee68fdb8..30e113f18 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -96,7 +96,7 @@ static struct GNUNET_CONTAINER_MultiHashMap *apps_places;
96 * Application subscriptions per place. 96 * Application subscriptions per place.
97 * H(place_pub_key) -> H(app_id) 97 * H(place_pub_key) -> H(app_id)
98 */ 98 */
99static struct GNUNET_CONTAINER_MultiHashMap *places_apps; 99//static struct GNUNET_CONTAINER_MultiHashMap *places_apps;
100 100
101/** 101/**
102 * Connected applications. 102 * Connected applications.
@@ -501,6 +501,9 @@ cleanup_host (struct Host *hst)
501static void 501static void
502cleanup_guest (struct Guest *gst) 502cleanup_guest (struct Guest *gst)
503{ 503{
504 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
505 "cleanup_guest, gst = %p\n",
506 gst);
504 struct Place *plc = &gst->place; 507 struct Place *plc = &gst->place;
505 struct GNUNET_CONTAINER_MultiHashMap * 508 struct GNUNET_CONTAINER_MultiHashMap *
506 plc_gst = GNUNET_CONTAINER_multihashmap_get (place_guests, 509 plc_gst = GNUNET_CONTAINER_multihashmap_get (place_guests,
@@ -536,7 +539,7 @@ cleanup_place (void *cls)
536{ 539{
537 struct Place *plc = cls; 540 struct Place *plc = cls;
538 541
539 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 542 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
540 "%p Cleaning up place %s\n", 543 "%p Cleaning up place %s\n",
541 plc, GNUNET_h2s (&plc->pub_key_hash)); 544 plc, GNUNET_h2s (&plc->pub_key_hash));
542 545
@@ -1173,7 +1176,11 @@ app_place_add (const char *app_id,
1173 return GNUNET_NO; 1176 return GNUNET_NO;
1174 1177
1175 if (GNUNET_SYSERR == place_add (ereq)) 1178 if (GNUNET_SYSERR == place_add (ereq))
1179 {
1180 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1181 "could not add place\n");
1176 return GNUNET_SYSERR; 1182 return GNUNET_SYSERR;
1183 }
1177 1184
1178 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (app_places, &ego_place_pub_hash, NULL, 1185 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (app_places, &ego_place_pub_hash, NULL,
1179 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 1186 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
@@ -1182,30 +1189,30 @@ app_place_add (const char *app_id,
1182 return GNUNET_SYSERR; 1189 return GNUNET_SYSERR;
1183 } 1190 }
1184 1191
1185 struct GNUNET_HashCode place_pub_hash; 1192 //struct GNUNET_HashCode place_pub_hash;
1186 GNUNET_CRYPTO_hash (&ereq->place_pub_key, sizeof (ereq->place_pub_key), &place_pub_hash); 1193 //GNUNET_CRYPTO_hash (&ereq->place_pub_key, sizeof (ereq->place_pub_key), &place_pub_hash);
1187 1194
1188 struct GNUNET_CONTAINER_MultiHashMap * 1195 //struct GNUNET_CONTAINER_MultiHashMap *
1189 place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash); 1196 // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
1190 if (NULL == place_apps) 1197 //if (NULL == place_apps)
1191 { 1198 //{
1192 place_apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); 1199 // place_apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
1193 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (places_apps, &place_pub_hash, place_apps, 1200 // if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (places_apps, &place_pub_hash, place_apps,
1194 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 1201 // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
1195 { 1202 // {
1196 GNUNET_break (0); 1203 // GNUNET_break (0);
1197 } 1204 // }
1198 } 1205 //}
1199 1206
1200 size_t app_id_size = strlen (app_id) + 1; 1207 //size_t app_id_size = strlen (app_id) + 1;
1201 void *app_id_value = GNUNET_malloc (app_id_size); 1208 //void *app_id_value = GNUNET_malloc (app_id_size);
1202 GNUNET_memcpy (app_id_value, app_id, app_id_size); 1209 //GNUNET_memcpy (app_id_value, app_id, app_id_size);
1203 1210
1204 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value, 1211 //if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value,
1205 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) 1212 // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
1206 { 1213 //{
1207 GNUNET_break (0); 1214 // GNUNET_break (0);
1208 } 1215 //}
1209 1216
1210 return GNUNET_OK; 1217 return GNUNET_OK;
1211} 1218}
@@ -1223,7 +1230,10 @@ static int
1223app_place_save (const char *app_id, 1230app_place_save (const char *app_id,
1224 const struct PlaceEnterRequest *ereq) 1231 const struct PlaceEnterRequest *ereq)
1225{ 1232{
1226 app_place_add (app_id, ereq); 1233 if (GNUNET_SYSERR == app_place_add (app_id, ereq))
1234 {
1235 GNUNET_assert (0);
1236 }
1227 1237
1228 if (NULL == dir_places) 1238 if (NULL == dir_places)
1229 return GNUNET_SYSERR; 1239 return GNUNET_SYSERR;
@@ -1304,17 +1314,17 @@ app_place_remove (const char *app_id,
1304 if (NULL != app_places) 1314 if (NULL != app_places)
1305 GNUNET_CONTAINER_multihashmap_remove (app_places, &place_pub_hash, NULL); 1315 GNUNET_CONTAINER_multihashmap_remove (app_places, &place_pub_hash, NULL);
1306 1316
1307 struct GNUNET_CONTAINER_MultiHashMap * 1317 //struct GNUNET_CONTAINER_MultiHashMap *
1308 place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash); 1318 // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
1309 if (NULL != place_apps) 1319 //if (NULL != place_apps)
1310 { 1320 //{
1311 void *app_id_value = GNUNET_CONTAINER_multihashmap_get (place_apps, &app_id_hash); 1321 // void *app_id_value = GNUNET_CONTAINER_multihashmap_get (place_apps, &app_id_hash);
1312 if (NULL != app_id_value) 1322 // if (NULL != app_id_value)
1313 { 1323 // {
1314 GNUNET_CONTAINER_multihashmap_remove (place_apps, &app_id_hash, app_id_value); 1324 // GNUNET_CONTAINER_multihashmap_remove (place_apps, &app_id_hash, app_id_value);
1315 GNUNET_free (app_id_value); 1325 // GNUNET_free (app_id_value);
1316 } 1326 // }
1317 } 1327 //}
1318 1328
1319 int ret = GNUNET_OK; 1329 int ret = GNUNET_OK;
1320 1330
@@ -1407,6 +1417,120 @@ msg_proc_parse (const struct MsgProcRequest *mpreq,
1407} 1417}
1408 1418
1409 1419
1420void
1421app_notify_place (const struct GNUNET_MessageHeader *msg,
1422 struct GNUNET_SERVICE_Client *client)
1423{
1424 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1425 "%p Sending place notification of type %u to client.\n",
1426 client, ntohs (msg->type));
1427
1428 uint16_t msg_size = ntohs (msg->size);
1429 struct AppPlaceMessage amsg;
1430 amsg.header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE);
1431 amsg.header.size = htons (sizeof (amsg));
1432 // FIXME: also notify about not entered places
1433 amsg.place_state = GNUNET_SOCIAL_PLACE_STATE_ENTERED;
1434
1435 switch (ntohs (msg->type))
1436 {
1437 case GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER:
1438 if (msg_size < sizeof (struct HostEnterRequest))
1439 return;
1440 struct HostEnterRequest *hreq = (struct HostEnterRequest *) msg;
1441 amsg.is_host = GNUNET_YES;
1442 amsg.ego_pub_key = hreq->ego_pub_key;
1443 amsg.place_pub_key = hreq->place_pub_key;
1444 break;
1445
1446 case GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER:
1447 if (msg_size < sizeof (struct GuestEnterRequest))
1448 return;
1449 struct GuestEnterRequest *greq = (struct GuestEnterRequest *) msg;
1450 amsg.is_host = GNUNET_NO;
1451 amsg.ego_pub_key = greq->ego_pub_key;
1452 amsg.place_pub_key = greq->place_pub_key;
1453 break;
1454
1455 default:
1456 return;
1457 }
1458
1459 client_send_msg (client, &amsg.header);
1460}
1461
1462
1463void
1464app_notify_place_end (struct GNUNET_SERVICE_Client *client)
1465{
1466 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1467 "%p Sending end of place list notification to client\n",
1468 client);
1469
1470 struct GNUNET_MessageHeader msg;
1471 msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END);
1472 msg.size = htons (sizeof (msg));
1473
1474 client_send_msg (client, &msg);
1475}
1476
1477
1478void
1479app_notify_ego (struct Ego *ego, struct GNUNET_SERVICE_Client *client)
1480{
1481 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1482 "%p Sending ego notification to client: %s\n",
1483 client, ego->name);
1484
1485 size_t name_size = strlen (ego->name) + 1;
1486 struct AppEgoMessage *emsg = GNUNET_malloc (sizeof (*emsg) + name_size);
1487 emsg->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO);
1488 emsg->header.size = htons (sizeof (*emsg) + name_size);
1489
1490 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
1491 GNUNET_memcpy (&emsg[1], ego->name, name_size);
1492
1493 client_send_msg (client, &emsg->header);
1494 GNUNET_free (emsg);
1495}
1496
1497
1498void
1499app_notify_ego_end (struct GNUNET_SERVICE_Client *client)
1500{
1501 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1502 "%p Sending end of ego list notification to client\n",
1503 client);
1504
1505 struct GNUNET_MessageHeader msg;
1506 msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END);
1507 msg.size = htons (sizeof (msg));
1508
1509 client_send_msg (client, &msg);
1510}
1511
1512
1513int
1514app_place_entry_notify (void *cls, const struct GNUNET_HashCode *key, void *value)
1515{
1516 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1517 "app_place_entry_notify\n");
1518 struct GNUNET_MessageHeader *
1519 msg = GNUNET_CONTAINER_multihashmap_get (places, key);
1520 if (NULL != msg)
1521 app_notify_place (msg, cls);
1522 return GNUNET_YES;
1523}
1524
1525
1526int
1527ego_entry (void *cls, const struct GNUNET_HashCode *key, void *value)
1528{
1529 app_notify_ego (value, cls);
1530 return GNUNET_YES;
1531}
1532
1533
1410static int 1534static int
1411check_client_msg_proc_set (void *cls, 1535check_client_msg_proc_set (void *cls,
1412 const struct MsgProcRequest *mpreq) 1536 const struct MsgProcRequest *mpreq)
@@ -1518,12 +1642,15 @@ static void
1518handle_client_host_enter (void *cls, 1642handle_client_host_enter (void *cls,
1519 const struct HostEnterRequest *hr) 1643 const struct HostEnterRequest *hr)
1520{ 1644{
1521 struct Client *c = cls; 1645 struct Client *c = cls;
1522 struct GNUNET_SERVICE_Client *client = c->client; 1646 struct GNUNET_SERVICE_Client *client = c->client;
1523 1647
1524 struct HostEnterRequest * 1648 struct HostEnterRequest *
1525 hreq = (struct HostEnterRequest *) GNUNET_copy_message (&hr->header); 1649 hreq = (struct HostEnterRequest *) GNUNET_copy_message (&hr->header);
1526 1650
1651 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1652 "handle_client_host_enter\n");
1653
1527 uint8_t app_id_size = ntohs (hreq->header.size) - sizeof (*hreq); 1654 uint8_t app_id_size = ntohs (hreq->header.size) - sizeof (*hreq);
1528 const char *app_id = NULL; 1655 const char *app_id = NULL;
1529 uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &hreq[1], 1656 uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &hreq[1],
@@ -1586,6 +1713,7 @@ handle_client_host_enter (void *cls,
1586 cli->client = client; 1713 cli->client = client;
1587 GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli); 1714 GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli);
1588 c->place = plc; 1715 c->place = plc;
1716 app_notify_place (&hreq->header, client);
1589 } 1717 }
1590 1718
1591 GNUNET_CRYPTO_eddsa_key_clear (&hreq->place_key); 1719 GNUNET_CRYPTO_eddsa_key_clear (&hreq->place_key);
@@ -1622,7 +1750,11 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1622 struct Ego *ego = GNUNET_CONTAINER_multihashmap_get (egos, &ego_pub_hash); 1750 struct Ego *ego = GNUNET_CONTAINER_multihashmap_get (egos, &ego_pub_hash);
1623 1751
1624 if (NULL == ego) 1752 if (NULL == ego)
1753 {
1754 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1755 "NULL == ego\n");
1625 return GNUNET_SYSERR; 1756 return GNUNET_SYSERR;
1757 }
1626 1758
1627 struct GNUNET_HashCode place_pub_hash; 1759 struct GNUNET_HashCode place_pub_hash;
1628 GNUNET_CRYPTO_hash (&greq->place_pub_key, sizeof (greq->place_pub_key), 1760 GNUNET_CRYPTO_hash (&greq->place_pub_key, sizeof (greq->place_pub_key),
@@ -1635,6 +1767,10 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1635 if (NULL != plc_gst) 1767 if (NULL != plc_gst)
1636 gst = GNUNET_CONTAINER_multihashmap_get (plc_gst, &ego_pub_hash); 1768 gst = GNUNET_CONTAINER_multihashmap_get (plc_gst, &ego_pub_hash);
1637 1769
1770 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1771 "guest enter, gst = %p\n",
1772 gst);
1773
1638 if (NULL == gst || NULL == gst->slave) 1774 if (NULL == gst || NULL == gst->slave)
1639 { 1775 {
1640 gst = GNUNET_new (struct Guest); 1776 gst = GNUNET_new (struct Guest);
@@ -1672,6 +1808,9 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1672 struct GNUNET_PSYC_Message *join_msg = NULL; 1808 struct GNUNET_PSYC_Message *join_msg = NULL;
1673 uint16_t join_msg_size = 0; 1809 uint16_t join_msg_size = 0;
1674 1810
1811 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1812 "guest_enter 2\n");
1813
1675 if (sizeof (struct GNUNET_MessageHeader) <= remaining) 1814 if (sizeof (struct GNUNET_MessageHeader) <= remaining)
1676 { 1815 {
1677 join_msg = (struct GNUNET_PSYC_Message *) p; 1816 join_msg = (struct GNUNET_PSYC_Message *) p;
@@ -1711,10 +1850,15 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1711 (void) GNUNET_CONTAINER_multihashmap_put (place_guests, &plc->pub_key_hash, plc_gst, 1850 (void) GNUNET_CONTAINER_multihashmap_put (place_guests, &plc->pub_key_hash, plc_gst,
1712 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1851 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1713 } 1852 }
1853 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1854 "Adding guest %p\n",
1855 gst);
1714 (void) GNUNET_CONTAINER_multihashmap_put (plc_gst, &plc->ego_pub_hash, gst, 1856 (void) GNUNET_CONTAINER_multihashmap_put (plc_gst, &plc->ego_pub_hash, gst,
1715 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1857 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1716 (void) GNUNET_CONTAINER_multihashmap_put (guests, &plc->pub_key_hash, gst, 1858 (void) GNUNET_CONTAINER_multihashmap_put (guests, &plc->pub_key_hash, gst,
1717 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1859 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1860 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1861 "GNUNET_PSYC_slave_join\n");
1718 gst->slave 1862 gst->slave
1719 = GNUNET_PSYC_slave_join (cfg, &plc->pub_key, &plc->ego_key, 1863 = GNUNET_PSYC_slave_join (cfg, &plc->pub_key, &plc->ego_key,
1720 gst->join_flags, &gst->origin, 1864 gst->join_flags, &gst->origin,
@@ -1748,9 +1892,14 @@ static void
1748handle_client_guest_enter (void *cls, 1892handle_client_guest_enter (void *cls,
1749 const struct GuestEnterRequest *greq) 1893 const struct GuestEnterRequest *greq)
1750{ 1894{
1895 // FIXME: this must not be called directly by gns_result_guest_enter because then
1896 // GNUNET_SERVICE_client_continue is called twice
1751 struct Client *c = cls; 1897 struct Client *c = cls;
1752 struct GNUNET_SERVICE_Client *client = c->client; 1898 struct GNUNET_SERVICE_Client *client = c->client;
1753 1899
1900 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1901 "handle_client_guest_enter\n");
1902
1754 uint16_t remaining = ntohs (greq->header.size) - sizeof (*greq); 1903 uint16_t remaining = ntohs (greq->header.size) - sizeof (*greq);
1755 const char *app_id = NULL; 1904 const char *app_id = NULL;
1756 uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &greq[1], 1905 uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &greq[1],
@@ -1771,6 +1920,7 @@ handle_client_guest_enter (void *cls,
1771 plc = c->place = &gst->place; 1920 plc = c->place = &gst->place;
1772 plc->guest = gst; 1921 plc->guest = gst;
1773 app_place_save (app_id, (const struct PlaceEnterRequest *) greq); 1922 app_place_save (app_id, (const struct PlaceEnterRequest *) greq);
1923 app_notify_place (&greq->header, client);
1774 break; 1924 break;
1775 1925
1776 case GNUNET_NO: 1926 case GNUNET_NO:
@@ -1960,118 +2110,7 @@ handle_client_guest_enter_by_name (void *cls,
1960 GNUNET_GNSRECORD_TYPE_PLACE, 2110 GNUNET_GNSRECORD_TYPE_PLACE,
1961 GNUNET_GNS_LO_DEFAULT, 2111 GNUNET_GNS_LO_DEFAULT,
1962 &gns_result_guest_enter, gcls); 2112 &gns_result_guest_enter, gcls);
1963} 2113 GNUNET_SERVICE_client_continue (client);
1964
1965
1966void
1967app_notify_place (struct GNUNET_MessageHeader *msg,
1968 struct GNUNET_SERVICE_Client *client)
1969{
1970 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1971 "%p Sending place notification of type %u to client.\n",
1972 client, ntohs (msg->type));
1973
1974 uint16_t msg_size = ntohs (msg->size);
1975 struct AppPlaceMessage amsg;
1976 amsg.header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE);
1977 amsg.header.size = htons (sizeof (amsg));
1978 // FIXME: also notify about not entered places
1979 amsg.place_state = GNUNET_SOCIAL_PLACE_STATE_ENTERED;
1980
1981 switch (ntohs (msg->type))
1982 {
1983 case GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER:
1984 if (msg_size < sizeof (struct HostEnterRequest))
1985 return;
1986 struct HostEnterRequest *hreq = (struct HostEnterRequest *) msg;
1987 amsg.is_host = GNUNET_YES;
1988 amsg.ego_pub_key = hreq->ego_pub_key;
1989 amsg.place_pub_key = hreq->place_pub_key;
1990 break;
1991
1992 case GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER:
1993 if (msg_size < sizeof (struct GuestEnterRequest))
1994 return;
1995 struct GuestEnterRequest *greq = (struct GuestEnterRequest *) msg;
1996 amsg.is_host = GNUNET_NO;
1997 amsg.ego_pub_key = greq->ego_pub_key;
1998 amsg.place_pub_key = greq->place_pub_key;
1999 break;
2000
2001 default:
2002 return;
2003 }
2004
2005 client_send_msg (client, &amsg.header);
2006}
2007
2008
2009void
2010app_notify_place_end (struct GNUNET_SERVICE_Client *client)
2011{
2012 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2013 "%p Sending end of place list notification to client\n",
2014 client);
2015
2016 struct GNUNET_MessageHeader msg;
2017 msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END);
2018 msg.size = htons (sizeof (msg));
2019
2020 client_send_msg (client, &msg);
2021}
2022
2023
2024void
2025app_notify_ego (struct Ego *ego, struct GNUNET_SERVICE_Client *client)
2026{
2027 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2028 "%p Sending ego notification to client: %s\n",
2029 client, ego->name);
2030
2031 size_t name_size = strlen (ego->name) + 1;
2032 struct AppEgoMessage *emsg = GNUNET_malloc (sizeof (*emsg) + name_size);
2033 emsg->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO);
2034 emsg->header.size = htons (sizeof (*emsg) + name_size);
2035
2036 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
2037 GNUNET_memcpy (&emsg[1], ego->name, name_size);
2038
2039 client_send_msg (client, &emsg->header);
2040 GNUNET_free (emsg);
2041}
2042
2043
2044void
2045app_notify_ego_end (struct GNUNET_SERVICE_Client *client)
2046{
2047 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2048 "%p Sending end of ego list notification to client\n",
2049 client);
2050
2051 struct GNUNET_MessageHeader msg;
2052 msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END);
2053 msg.size = htons (sizeof (msg));
2054
2055 client_send_msg (client, &msg);
2056}
2057
2058
2059int
2060app_place_entry_notify (void *cls, const struct GNUNET_HashCode *key, void *value)
2061{
2062 struct GNUNET_MessageHeader *
2063 msg = GNUNET_CONTAINER_multihashmap_get (places, key);
2064 if (NULL != msg)
2065 app_notify_place (msg, cls);
2066 return GNUNET_YES;
2067}
2068
2069
2070int
2071ego_entry (void *cls, const struct GNUNET_HashCode *key, void *value)
2072{
2073 app_notify_ego (value, cls);
2074 return GNUNET_YES;
2075} 2114}
2076 2115
2077 2116
@@ -2107,6 +2146,8 @@ handle_client_app_connect (void *cls,
2107 struct GNUNET_HashCode app_id_hash; 2146 struct GNUNET_HashCode app_id_hash;
2108 GNUNET_CRYPTO_hash (app_id, app_id_size, &app_id_hash); 2147 GNUNET_CRYPTO_hash (app_id, app_id_size, &app_id_hash);
2109 2148
2149 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2150 "iterating egos\n");
2110 GNUNET_CONTAINER_multihashmap_iterate (egos, ego_entry, client); 2151 GNUNET_CONTAINER_multihashmap_iterate (egos, ego_entry, client);
2111 app_notify_ego_end (client); 2152 app_notify_ego_end (client);
2112 2153
@@ -2174,6 +2215,10 @@ handle_client_place_leave (void *cls,
2174 struct Client *c = cls; 2215 struct Client *c = cls;
2175 struct GNUNET_SERVICE_Client *client = c->client; 2216 struct GNUNET_SERVICE_Client *client = c->client;
2176 struct Place *plc = c->place; 2217 struct Place *plc = c->place;
2218
2219 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2220 "handle_client_place_leave\n");
2221
2177 if (NULL == plc) 2222 if (NULL == plc)
2178 { 2223 {
2179 GNUNET_break (0); 2224 GNUNET_break (0);
@@ -2183,12 +2228,12 @@ handle_client_place_leave (void *cls,
2183 2228
2184 /* FIXME: remove all app subscriptions and leave this place */ 2229 /* FIXME: remove all app subscriptions and leave this place */
2185 2230
2186 struct GNUNET_CONTAINER_MultiHashMap * 2231 //struct GNUNET_CONTAINER_MultiHashMap *
2187 place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &plc->pub_key_hash); 2232 // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &plc->pub_key_hash);
2188 if (NULL != place_apps) 2233 //if (NULL != place_apps)
2189 { 2234 //{
2190 GNUNET_CONTAINER_multihashmap_iterate (place_apps, app_places_entry_remove, plc); 2235 // GNUNET_CONTAINER_multihashmap_iterate (place_apps, app_places_entry_remove, plc);
2191 } 2236 //}
2192 2237
2193 /* FIXME: disconnect from the network, but keep local connection for history access */ 2238 /* FIXME: disconnect from the network, but keep local connection for history access */
2194 2239
@@ -2215,6 +2260,7 @@ handle_client_place_leave (void *cls,
2215 cleanup_place (plc); 2260 cleanup_place (plc);
2216 } 2261 }
2217 } 2262 }
2263 //GNUNET_SERVICE_client_continue (client);
2218} 2264}
2219 2265
2220 2266
@@ -3237,6 +3283,8 @@ namestore_recv_records_store_result (void *cls, int32_t result,
3237 struct OperationClosure *opcls = cls; 3283 struct OperationClosure *opcls = cls;
3238 struct Client *c = opcls->client; 3284 struct Client *c = opcls->client;
3239 3285
3286 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3287 "namestore_recv_records_store_result\n");
3240 // FIXME: client might have been disconnected 3288 // FIXME: client might have been disconnected
3241 client_send_result (c->client, opcls->op_id, result, err_msg, 3289 client_send_result (c->client, opcls->op_id, result, err_msg,
3242 (NULL != err_msg) ? strlen (err_msg) : 0); 3290 (NULL != err_msg) ? strlen (err_msg) : 0);
@@ -3468,7 +3516,10 @@ file_place_load (void *cls, const char *place_filename)
3468 return GNUNET_OK; 3516 return GNUNET_OK;
3469 } 3517 }
3470 3518
3471 app_place_add (plcls->app_id, ereq); 3519 if (GNUNET_SYSERR == app_place_add (plcls->app_id, ereq))
3520 {
3521 GNUNET_assert (0);
3522 }
3472 GNUNET_free (ereq); 3523 GNUNET_free (ereq);
3473 return GNUNET_OK; 3524 return GNUNET_OK;
3474} 3525}
@@ -3523,6 +3574,10 @@ identity_recv_ego (void *cls, struct GNUNET_IDENTITY_Ego *id_ego,
3523 if (NULL == id_ego) // end of initial list of egos 3574 if (NULL == id_ego) // end of initial list of egos
3524 return; 3575 return;
3525 3576
3577 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3578 "social service received ego %s\n",
3579 name);
3580
3526 struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key; 3581 struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
3527 GNUNET_IDENTITY_ego_get_public_key (id_ego, &ego_pub_key); 3582 GNUNET_IDENTITY_ego_get_public_key (id_ego, &ego_pub_key);
3528 3583
@@ -3571,6 +3626,9 @@ run (void *cls,
3571 const struct GNUNET_CONFIGURATION_Handle *c, 3626 const struct GNUNET_CONFIGURATION_Handle *c,
3572 struct GNUNET_SERVICE_Handle *svc) 3627 struct GNUNET_SERVICE_Handle *svc)
3573{ 3628{
3629 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3630 "starting social service\n");
3631
3574 cfg = c; 3632 cfg = c;
3575 service = svc; 3633 service = svc;
3576 GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer); 3634 GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
@@ -3583,7 +3641,7 @@ run (void *cls,
3583 apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); 3641 apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
3584 places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO); 3642 places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
3585 apps_places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO); 3643 apps_places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
3586 places_apps = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO); 3644 //places_apps = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
3587 3645
3588 id = GNUNET_IDENTITY_connect (cfg, &identity_recv_ego, NULL); 3646 id = GNUNET_IDENTITY_connect (cfg, &identity_recv_ego, NULL);
3589 gns = GNUNET_GNS_connect (cfg); 3647 gns = GNUNET_GNS_connect (cfg);
diff --git a/src/social/social_api.c b/src/social/social_api.c
index af1d6e57e..04b671120 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -818,6 +818,9 @@ handle_host_enter_request (void *cls,
818{ 818{
819 struct GNUNET_SOCIAL_Host *hst = cls; 819 struct GNUNET_SOCIAL_Host *hst = cls;
820 820
821 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
822 "handle_host_enter_request\n");
823
821 if (NULL == hst->answer_door_cb) 824 if (NULL == hst->answer_door_cb)
822 return; 825 return;
823 826
@@ -1042,7 +1045,7 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
1042{ 1045{
1043 struct GNUNET_HashCode place_pub_hash; 1046 struct GNUNET_HashCode place_pub_hash;
1044 GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash); 1047 GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
1045 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1048 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1046 "%s place cleanup: %s\n", 1049 "%s place cleanup: %s\n",
1047 GNUNET_YES == plc->is_host ? "host" : "guest", 1050 GNUNET_YES == plc->is_host ? "host" : "guest",
1048 GNUNET_h2s (&place_pub_hash)); 1051 GNUNET_h2s (&place_pub_hash));
@@ -1075,19 +1078,17 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
1075 1078
1076 1079
1077void 1080void
1078place_disconnect (struct GNUNET_SOCIAL_Place *plc, 1081place_disconnect (struct GNUNET_SOCIAL_Place *plc)
1079 GNUNET_ContinuationCallback cb,
1080 void *cls)
1081{ 1082{
1082 plc->disconnect_cb = cb; 1083 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1083 plc->disconnect_cls = cls; 1084 "place_disconnect, plc = %p\n",
1084 1085 plc);
1085 if (NULL != plc->mq) 1086 if (NULL != plc->mq)
1086 { 1087 {
1087 struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq); 1088 struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
1088 if (NULL != env) 1089 if (NULL != env)
1089 { 1090 {
1090 GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_cleanup, plc); 1091 GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_disconnect, plc);
1091 } 1092 }
1092 else 1093 else
1093 { 1094 {
@@ -1104,6 +1105,8 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc,
1104void 1105void
1105place_leave (struct GNUNET_SOCIAL_Place *plc) 1106place_leave (struct GNUNET_SOCIAL_Place *plc)
1106{ 1107{
1108 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1109 "social_api: place_leave\n");
1107 struct GNUNET_MessageHeader *msg; 1110 struct GNUNET_MessageHeader *msg;
1108 struct GNUNET_MQ_Envelope * 1111 struct GNUNET_MQ_Envelope *
1109 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE); 1112 env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
@@ -1580,7 +1583,11 @@ GNUNET_SOCIAL_host_disconnect (struct GNUNET_SOCIAL_Host *hst,
1580 GNUNET_ContinuationCallback disconnect_cb, 1583 GNUNET_ContinuationCallback disconnect_cb,
1581 void *cls) 1584 void *cls)
1582{ 1585{
1583 place_disconnect (&hst->plc, disconnect_cb, cls); 1586 struct GNUNET_SOCIAL_Place *plc = &hst->plc;
1587
1588 plc->disconnect_cb = disconnect_cb;
1589 plc->disconnect_cls = cls;
1590 place_disconnect (plc);
1584} 1591}
1585 1592
1586 1593
@@ -1607,6 +1614,8 @@ GNUNET_SOCIAL_host_leave (struct GNUNET_SOCIAL_Host *hst,
1607 GNUNET_ContinuationCallback disconnect_cb, 1614 GNUNET_ContinuationCallback disconnect_cb,
1608 void *cls) 1615 void *cls)
1609{ 1616{
1617 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1618 "GNUNET_SOCIAL_host_leave\n");
1610 GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL, 1619 GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL,
1611 GNUNET_SOCIAL_ANNOUNCE_NONE); 1620 GNUNET_SOCIAL_ANNOUNCE_NONE);
1612 place_leave (&hst->plc); 1621 place_leave (&hst->plc);
@@ -2028,7 +2037,14 @@ GNUNET_SOCIAL_guest_disconnect (struct GNUNET_SOCIAL_Guest *gst,
2028 GNUNET_ContinuationCallback disconnect_cb, 2037 GNUNET_ContinuationCallback disconnect_cb,
2029 void *cls) 2038 void *cls)
2030{ 2039{
2031 place_disconnect (&gst->plc, disconnect_cb, cls); 2040 struct GNUNET_SOCIAL_Place *plc = &gst->plc;
2041
2042 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2043 "GNUNET_SOCIAL_guest_disconnect, gst = %p\n",
2044 gst);
2045 plc->disconnect_cb = disconnect_cb;
2046 plc->disconnect_cls = cls;
2047 place_disconnect (plc);
2032} 2048}
2033 2049
2034 2050
diff --git a/src/social/test_social.c b/src/social/test_social.c
index 64ef10125..505780a69 100644
--- a/src/social/test_social.c
+++ b/src/social/test_social.c
@@ -129,22 +129,22 @@ enum
129 TEST_HOST_ANSWER_DOOR_REFUSE = 4, 129 TEST_HOST_ANSWER_DOOR_REFUSE = 4,
130 TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5, 130 TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5,
131 TEST_HOST_ANSWER_DOOR_ADMIT = 6, 131 TEST_HOST_ANSWER_DOOR_ADMIT = 6,
132 TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 9, 132 TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 7,
133 TEST_HOST_ANNOUNCE = 10, 133 TEST_HOST_ANNOUNCE = 8,
134 TEST_HOST_ANNOUNCE_END = 11, 134 TEST_HOST_ANNOUNCE_END = 9,
135 TEST_GUEST_TALK = 12, 135 TEST_GUEST_TALK = 10,
136 TEST_HOST_ANNOUNCE2 = 13, 136 TEST_HOST_ANNOUNCE2 = 11,
137 TEST_HOST_ANNOUNCE2_END = 14, 137 TEST_HOST_ANNOUNCE2_END = 12,
138 TEST_GUEST_HISTORY_REPLAY = 15, 138 TEST_GUEST_HISTORY_REPLAY = 13,
139 TEST_GUEST_HISTORY_REPLAY_LATEST = 16, 139 TEST_GUEST_HISTORY_REPLAY_LATEST = 14,
140 TEST_GUEST_LOOK_AT = 17, 140 TEST_GUEST_LOOK_AT = 15,
141 TEST_GUEST_LOOK_FOR = 18, 141 TEST_GUEST_LOOK_FOR = 16,
142 TEST_GUEST_LEAVE = 18, 142 TEST_GUEST_LEAVE = 17,
143 TEST_ZONE_ADD_PLACE = 20, 143 TEST_ZONE_ADD_PLACE = 18,
144 TEST_GUEST_ENTER_BY_NAME = 21, 144 TEST_GUEST_ENTER_BY_NAME = 19,
145 TEST_RECONNECT = 22, 145 TEST_RECONNECT = 20,
146 TEST_GUEST_LEAVE2 = 23, 146 TEST_GUEST_LEAVE2 = 21,
147 TEST_HOST_LEAVE = 24, 147 TEST_HOST_LEAVE = 22,
148} test; 148} test;
149 149
150 150
@@ -254,7 +254,7 @@ end_normally (void *cls)
254static void 254static void
255end () 255end ()
256{ 256{
257 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 257 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
258 "Test #%u: Ending tests.\n", test); 258 "Test #%u: Ending tests.\n", test);
259 259
260 if (end_badly_task != NULL) 260 if (end_badly_task != NULL)
@@ -271,7 +271,7 @@ transmit_resume (void *cls)
271{ 271{
272 struct TransmitClosure *tmit = cls; 272 struct TransmitClosure *tmit = cls;
273 273
274 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 274 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
275 "Test #%u: Transmission resumed.\n", test); 275 "Test #%u: Transmission resumed.\n", test);
276 if (NULL != tmit->host_ann) 276 if (NULL != tmit->host_ann)
277 GNUNET_SOCIAL_host_announce_resume (tmit->host_ann); 277 GNUNET_SOCIAL_host_announce_resume (tmit->host_ann);
@@ -296,7 +296,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
296 } 296 }
297 297
298 uint16_t size = strlen (tmit->data[tmit->n]); 298 uint16_t size = strlen (tmit->data[tmit->n]);
299 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 299 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
300 "Test #%u: Transmit notify data: %u bytes available, " 300 "Test #%u: Transmit notify data: %u bytes available, "
301 "processing fragment %u/%u (size %u).\n", 301 "processing fragment %u/%u (size %u).\n",
302 test, *data_size, tmit->n + 1, tmit->data_count, size); 302 test, *data_size, tmit->n + 1, tmit->data_count, size);
@@ -309,7 +309,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
309 309
310 if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n]) 310 if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n])
311 { 311 {
312 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 312 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
313 "Test #%u: Transmission paused.\n", test); 313 "Test #%u: Transmission paused.\n", test);
314 tmit->paused = GNUNET_YES; 314 tmit->paused = GNUNET_YES;
315 GNUNET_SCHEDULER_add_delayed ( 315 GNUNET_SCHEDULER_add_delayed (
@@ -331,7 +331,7 @@ notify_data (void *cls, uint16_t *data_size, void *data)
331static void 331static void
332host_left () 332host_left ()
333{ 333{
334 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 334 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
335 "Test #%u: The host has left the place.\n", test); 335 "Test #%u: The host has left the place.\n", test);
336 end (); 336 end ();
337} 337}
@@ -365,7 +365,7 @@ host_reconnected (void *cls, int result,
365{ 365{
366 place_pub_key = *home_pub_key; 366 place_pub_key = *home_pub_key;
367 GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); 367 GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash);
368 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 368 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
369 "Test #%u: Host reconnected to place %s\n", 369 "Test #%u: Host reconnected to place %s\n",
370 test, GNUNET_h2s (&place_pub_hash)); 370 test, GNUNET_h2s (&place_pub_hash));
371 371
@@ -382,7 +382,7 @@ guest_reconnected (void *cls, int result,
382 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, 382 const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
383 uint64_t max_message_id) 383 uint64_t max_message_id)
384{ 384{
385 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 385 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
386 "Test #%u: Guest reconnected to place: %d\n", 386 "Test #%u: Guest reconnected to place: %d\n",
387 test, result); 387 test, result);
388 GNUNET_assert (0 <= result); 388 GNUNET_assert (0 <= result);
@@ -398,7 +398,7 @@ guest_reconnected (void *cls, int result,
398static void 398static void
399app_connected (void *cls) 399app_connected (void *cls)
400{ 400{
401 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 401 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
402 "Test #%u: App connected: %p\n", test, cls); 402 "Test #%u: App connected: %p\n", test, cls);
403} 403}
404 404
@@ -413,7 +413,7 @@ app_recv_host (void *cls,
413 struct GNUNET_HashCode host_pub_hash; 413 struct GNUNET_HashCode host_pub_hash;
414 GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash); 414 GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash);
415 415
416 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 416 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
417 "Test #%u: Got app host place notification: %s\n", 417 "Test #%u: Got app host place notification: %s\n",
418 test, GNUNET_h2s (&host_pub_hash)); 418 test, GNUNET_h2s (&host_pub_hash));
419 419
@@ -421,7 +421,7 @@ app_recv_host (void *cls,
421 { 421 {
422 if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key))) 422 if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key)))
423 { 423 {
424 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 424 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
425 "Test #%u: Reconnecting to host place: %s\n", 425 "Test #%u: Reconnecting to host place: %s\n",
426 test, GNUNET_h2s (&host_pub_hash)); 426 test, GNUNET_h2s (&host_pub_hash));
427 hst = GNUNET_SOCIAL_host_enter_reconnect (hconn, host_slicer, host_reconnected, 427 hst = GNUNET_SOCIAL_host_enter_reconnect (hconn, host_slicer, host_reconnected,
@@ -441,7 +441,7 @@ app_recv_guest (void *cls,
441 struct GNUNET_HashCode guest_pub_hash; 441 struct GNUNET_HashCode guest_pub_hash;
442 GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash); 442 GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash);
443 443
444 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 444 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
445 "Test #%u: Got app guest place notification: %s\n", 445 "Test #%u: Got app guest place notification: %s\n",
446 test, GNUNET_h2s (&guest_pub_hash)); 446 test, GNUNET_h2s (&guest_pub_hash));
447 447
@@ -449,7 +449,7 @@ app_recv_guest (void *cls,
449 { 449 {
450 if (0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key))) 450 if (0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key)))
451 { 451 {
452 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 452 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
453 "Test #%u: Reconnecting to guest place: %s\n", 453 "Test #%u: Reconnecting to guest place: %s\n",
454 test, GNUNET_h2s (&guest_pub_hash)); 454 test, GNUNET_h2s (&guest_pub_hash));
455 gst = GNUNET_SOCIAL_guest_enter_reconnect (gconn, GNUNET_PSYC_SLAVE_JOIN_NONE, 455 gst = GNUNET_SOCIAL_guest_enter_reconnect (gconn, GNUNET_PSYC_SLAVE_JOIN_NONE,
@@ -487,15 +487,30 @@ app_recv_ego (void *cls,
487 { 487 {
488 host_ego = ego; 488 host_ego = ego;
489 host_pub_key = ego_pub_key; 489 host_pub_key = ego_pub_key;
490 GNUNET_assert (TEST_IDENTITIES_CREATE == test); 490 if (TEST_IDENTITIES_CREATE == test)
491 enter_if_ready (); 491 {
492 enter_if_ready ();
493 }
494 else
495 {
496 GNUNET_assert (TEST_RECONNECT == test);
497 }
492 } 498 }
493 else if (NULL != strstr (name, guest_name)) 499 else if (NULL != strstr (name, guest_name))
494 { 500 {
495 guest_ego = ego; 501 guest_ego = ego;
496 guest_pub_key = ego_pub_key; 502 guest_pub_key = ego_pub_key;
497 GNUNET_assert (TEST_IDENTITIES_CREATE == test); 503 if (TEST_IDENTITIES_CREATE == test)
498 enter_if_ready (); 504 {
505 enter_if_ready ();
506 }
507 else
508 {
509 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
510 "test = %d\n",
511 test);
512 GNUNET_assert (TEST_RECONNECT == test);
513 }
499 } 514 }
500} 515}
501 516
@@ -524,7 +539,7 @@ static void
524host_recv_zone_add_place_result (void *cls, int64_t result, 539host_recv_zone_add_place_result (void *cls, int64_t result,
525 const void *data, uint16_t data_size) 540 const void *data, uint16_t data_size)
526{ 541{
527 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 542 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
528 "Test #%u: Zone add place result: %" PRId64 " (%.*s).\n", 543 "Test #%u: Zone add place result: %" PRId64 " (%.*s).\n",
529 test, result, data_size, (const char *) data); 544 test, result, data_size, (const char *) data);
530 GNUNET_assert (GNUNET_YES == result); 545 GNUNET_assert (GNUNET_YES == result);
@@ -538,7 +553,7 @@ static void
538zone_add_place () 553zone_add_place ()
539{ 554{
540 test = TEST_ZONE_ADD_PLACE; 555 test = TEST_ZONE_ADD_PLACE;
541 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 556 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
542 "Test #%u: Adding place to zone.\n", test); 557 "Test #%u: Adding place to zone.\n", test);
543 558
544 GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!", 559 GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!",
@@ -557,7 +572,7 @@ host_farewell (void *cls,
557 nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym); 572 nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym);
558 573
559 char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key); 574 char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key);
560 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 575 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
561 "Test #%u: Farewell: nym %s (%s) has left the place.\n", 576 "Test #%u: Farewell: nym %s (%s) has left the place.\n",
562 test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); 577 test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str);
563 GNUNET_free (str); 578 GNUNET_free (str);
@@ -578,7 +593,7 @@ host_farewell (void *cls,
578static void 593static void
579guest_left (void *cls) 594guest_left (void *cls)
580{ 595{
581 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 596 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
582 "Test #%u: The guest has left the place.\n", test); 597 "Test #%u: The guest has left the place.\n", test);
583} 598}
584 599
@@ -615,11 +630,11 @@ guest_look_for_result (void *cls,
615 uint16_t data_size) 630 uint16_t data_size)
616{ 631{
617 struct ResultClosure *rcls = cls; 632 struct ResultClosure *rcls = cls;
618 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 633 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
619 "Test #%u: guest_look_for_result: %" PRId64 "\n", 634 "Test #%u: guest_look_for_result: %" PRId64 "\n",
620 test, result_code); 635 test, result_code);
621 GNUNET_assert (GNUNET_OK == result_code); 636 GNUNET_assert (GNUNET_OK == result_code);
622 GNUNET_assert (3 == rcls->n); 637 GNUNET_assert (6 == rcls->n);
623 GNUNET_free (rcls); 638 GNUNET_free (rcls);
624 GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); 639 GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL);
625} 640}
@@ -635,7 +650,7 @@ guest_look_for_var (void *cls,
635{ 650{
636 struct ResultClosure *rcls = cls; 651 struct ResultClosure *rcls = cls;
637 rcls->n++; 652 rcls->n++;
638 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 653 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
639 "Test #%u: guest_look_for_var: %s\n%.*s\n", 654 "Test #%u: guest_look_for_var: %s\n%.*s\n",
640 test, name, value_size, (const char *) value); 655 test, name, value_size, (const char *) value);
641} 656}
@@ -656,7 +671,7 @@ guest_look_at_result (void *cls, int64_t result_code,
656{ 671{
657 struct ResultClosure *rcls = cls; 672 struct ResultClosure *rcls = cls;
658 673
659 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 674 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
660 "Test #%u: guest_look_at_result: %" PRId64 "\n", 675 "Test #%u: guest_look_at_result: %" PRId64 "\n",
661 test, result_code); 676 test, result_code);
662 GNUNET_assert (GNUNET_OK == result_code); 677 GNUNET_assert (GNUNET_OK == result_code);
@@ -677,7 +692,7 @@ guest_look_at_var (void *cls,
677 struct ResultClosure *rcls = cls; 692 struct ResultClosure *rcls = cls;
678 rcls->n++; 693 rcls->n++;
679 694
680 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 695 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
681 "Test #%u: guest_look_at_var: %s\n%.*s\n", 696 "Test #%u: guest_look_at_var: %s\n%.*s\n",
682 test ,name, value_size, (const char *) value); 697 test ,name, value_size, (const char *) value);
683} 698}
@@ -696,7 +711,7 @@ static void
696guest_recv_history_replay_latest_result (void *cls, int64_t result, 711guest_recv_history_replay_latest_result (void *cls, int64_t result,
697 const void *data, uint16_t data_size) 712 const void *data, uint16_t data_size)
698{ 713{
699 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 714 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
700 "Test #%u: Guest received latest history replay result " 715 "Test #%u: Guest received latest history replay result "
701 "(%" PRIu32 " messages, %" PRId64 " fragments):\n" 716 "(%" PRIu32 " messages, %" PRId64 " fragments):\n"
702 "%.*s\n", 717 "%.*s\n",
@@ -725,7 +740,7 @@ static void
725guest_recv_history_replay_result (void *cls, int64_t result, 740guest_recv_history_replay_result (void *cls, int64_t result,
726 const void *data, uint16_t data_size) 741 const void *data, uint16_t data_size)
727{ 742{
728 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 743 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
729 "Test #%u: Guest received history replay result: %" PRId64 "\n" 744 "Test #%u: Guest received history replay result: %" PRId64 "\n"
730 "%.*s\n", 745 "%.*s\n",
731 test, result, data_size, (const char *) data); 746 test, result, data_size, (const char *) data);
@@ -756,7 +771,7 @@ guest_recv_method (void *cls,
756 uint64_t message_id, 771 uint64_t message_id,
757 const char *method_name) 772 const char *method_name)
758{ 773{
759 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 774 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
760 "Test #%u: Guest received method for message ID %" PRIu64 ":\n" 775 "Test #%u: Guest received method for message ID %" PRIu64 ":\n"
761 "%s (flags: %x)\n", 776 "%s (flags: %x)\n",
762 test, message_id, method_name, ntohl (meth->flags)); 777 test, message_id, method_name, ntohl (meth->flags));
@@ -775,7 +790,7 @@ guest_recv_modifier (void *cls,
775 uint16_t value_size, 790 uint16_t value_size,
776 uint16_t full_value_size) 791 uint16_t full_value_size)
777{ 792{
778 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 793 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
779 "Test #%u: Guest received modifier for message ID %" PRIu64 ":\n" 794 "Test #%u: Guest received modifier for message ID %" PRIu64 ":\n"
780 "%c%s: %.*s (size: %u)\n", 795 "%c%s: %.*s (size: %u)\n",
781 test, message_id, oper, name, value_size, (const char *) value, value_size); 796 test, message_id, oper, name, value_size, (const char *) value, value_size);
@@ -793,7 +808,7 @@ guest_recv_mod_foo_bar (void *cls,
793 uint16_t value_size, 808 uint16_t value_size,
794 uint16_t full_value_size) 809 uint16_t full_value_size)
795{ 810{
796 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 811 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
797 "Test #%u: Guest received modifier matching _foo_bar for message ID %" PRIu64 ":\n" 812 "Test #%u: Guest received modifier matching _foo_bar for message ID %" PRIu64 ":\n"
798 "%c%s: %.*s (size: %u)\n", 813 "%c%s: %.*s (size: %u)\n",
799 test, message_id, oper, name, value_size, (const char *) value, value_size); 814 test, message_id, oper, name, value_size, (const char *) value, value_size);
@@ -811,7 +826,7 @@ guest_recv_data (void *cls,
811 const void *data, 826 const void *data,
812 uint16_t data_size) 827 uint16_t data_size)
813{ 828{
814 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 829 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
815 "Test #%u: Guest received data for message ID %" PRIu64 ":\n" 830 "Test #%u: Guest received data for message ID %" PRIu64 ":\n"
816 "%.*s\n", 831 "%.*s\n",
817 test, message_id, data_size, (const char *) data); 832 test, message_id, data_size, (const char *) data);
@@ -826,7 +841,7 @@ guest_recv_eom (void *cls,
826 uint64_t message_id, 841 uint64_t message_id,
827 uint8_t is_cancelled) 842 uint8_t is_cancelled)
828{ 843{
829 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 844 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
830 "Test #%u: Guest received end of message ID %" PRIu64 845 "Test #%u: Guest received end of message ID %" PRIu64
831 ", cancelled: %u\n", 846 ", cancelled: %u\n",
832 test, message_id, is_cancelled); 847 test, message_id, is_cancelled);
@@ -868,7 +883,7 @@ host_recv_method (void *cls,
868 uint64_t message_id, 883 uint64_t message_id,
869 const char *method_name) 884 const char *method_name)
870{ 885{
871 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 886 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
872 "Test #%u: Host received method for message ID %" PRIu64 ":\n" 887 "Test #%u: Host received method for message ID %" PRIu64 ":\n"
873 "%s\n", 888 "%s\n",
874 test, message_id, method_name); 889 test, message_id, method_name);
@@ -887,7 +902,7 @@ host_recv_modifier (void *cls,
887 uint16_t value_size, 902 uint16_t value_size,
888 uint16_t full_value_size) 903 uint16_t full_value_size)
889{ 904{
890 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 905 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
891 "Test #%u: Host received modifier for message ID %" PRIu64 ":\n" 906 "Test #%u: Host received modifier for message ID %" PRIu64 ":\n"
892 "%c%s: %.*s\n", 907 "%c%s: %.*s\n",
893 test, message_id, oper, name, value_size, (const char *) value); 908 test, message_id, oper, name, value_size, (const char *) value);
@@ -902,7 +917,7 @@ host_recv_data (void *cls,
902 const void *data, 917 const void *data,
903 uint16_t data_size) 918 uint16_t data_size)
904{ 919{
905 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 920 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
906 "Test #%u: Host received data for message ID %" PRIu64 ":\n" 921 "Test #%u: Host received data for message ID %" PRIu64 ":\n"
907 "%.*s\n", 922 "%.*s\n",
908 test, message_id, data_size, (const char *) data); 923 test, message_id, data_size, (const char *) data);
@@ -916,7 +931,7 @@ host_recv_eom (void *cls,
916 uint64_t message_id, 931 uint64_t message_id,
917 uint8_t is_cancelled) 932 uint8_t is_cancelled)
918{ 933{
919 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 934 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
920 "Test #%u: Host received end of message ID %" PRIu64 935 "Test #%u: Host received end of message ID %" PRIu64
921 ", cancelled: %u\n", 936 ", cancelled: %u\n",
922 test, message_id, is_cancelled); 937 test, message_id, is_cancelled);
@@ -981,7 +996,7 @@ host_announce ()
981{ 996{
982 test = TEST_HOST_ANNOUNCE; 997 test = TEST_HOST_ANNOUNCE;
983 998
984 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 999 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
985 "Test #%u: Host announcement.\n", test); 1000 "Test #%u: Host announcement.\n", test);
986 1001
987 tmit = (struct TransmitClosure) {}; 1002 tmit = (struct TransmitClosure) {};
@@ -1015,7 +1030,7 @@ host_announce2 ()
1015 1030
1016 test = TEST_HOST_ANNOUNCE2; 1031 test = TEST_HOST_ANNOUNCE2;
1017 1032
1018 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1033 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1019 "Test #%u: Host announcement 2.\n", test); 1034 "Test #%u: Host announcement 2.\n", test);
1020 1035
1021 tmit = (struct TransmitClosure) {}; 1036 tmit = (struct TransmitClosure) {};
@@ -1025,7 +1040,7 @@ host_announce2 ()
1025 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, 1040 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
1026 "_foo2_bar", DATA2ARG ("FOO BAR")); 1041 "_foo2_bar", DATA2ARG ("FOO BAR"));
1027 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, 1042 GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
1028 "_foo2_bar", DATA2ARG ("FOO BAR BAZ")); 1043 "_foo2_bar_baz", DATA2ARG ("FOO BAR BAZ"));
1029 tmit.data[0] = "AAA BBB CCC "; 1044 tmit.data[0] = "AAA BBB CCC ";
1030 tmit.data[1] = "ABC DEF GHI JKL.\n"; 1045 tmit.data[1] = "ABC DEF GHI JKL.\n";
1031 tmit.data[2] = "TESTING ONE TWO THREE.\n"; 1046 tmit.data[2] = "TESTING ONE TWO THREE.\n";
@@ -1097,7 +1112,7 @@ host_answer_door (void *cls,
1097{ 1112{
1098 join_req_count++; 1113 join_req_count++;
1099 1114
1100 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1115 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1101 "Test #%u: Host received entry request from guest (try %u).\n", 1116 "Test #%u: Host received entry request from guest (try %u).\n",
1102 (uint8_t) test, join_req_count); 1117 (uint8_t) test, join_req_count);
1103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1177,7 +1192,7 @@ static void
1177guest_enter_by_name () 1192guest_enter_by_name ()
1178{ 1193{
1179 test = TEST_GUEST_ENTER_BY_NAME; 1194 test = TEST_GUEST_ENTER_BY_NAME;
1180 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1195 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1181 "Test #%u: Entering to place by name as guest.\n", test); 1196 "Test #%u: Entering to place by name as guest.\n", test);
1182 1197
1183 struct GuestEnterMessage *emsg = &guest_enter_msg; 1198 struct GuestEnterMessage *emsg = &guest_enter_msg;
@@ -1306,6 +1321,8 @@ start_app_if_ready ()
1306 { 1321 {
1307 return; 1322 return;
1308 } 1323 }
1324 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1325 "starting app...\n");
1309 app = GNUNET_SOCIAL_app_connect (cfg, 1326 app = GNUNET_SOCIAL_app_connect (cfg,
1310 app_id, 1327 app_id,
1311 app_recv_ego, 1328 app_recv_ego,