* Application subscriptions per place.
* H(place_pub_key) -> H(app_id)
*/
-static struct GNUNET_CONTAINER_MultiHashMap *places_apps;
+//static struct GNUNET_CONTAINER_MultiHashMap *places_apps;
/**
* Connected applications.
static void
cleanup_guest (struct Guest *gst)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "cleanup_guest, gst = %p\n",
+ gst);
struct Place *plc = &gst->place;
struct GNUNET_CONTAINER_MultiHashMap *
plc_gst = GNUNET_CONTAINER_multihashmap_get (place_guests,
{
struct Place *plc = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"%p Cleaning up place %s\n",
plc, GNUNET_h2s (&plc->pub_key_hash));
return GNUNET_NO;
if (GNUNET_SYSERR == place_add (ereq))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "could not add place\n");
return GNUNET_SYSERR;
+ }
if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (app_places, &ego_place_pub_hash, NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
return GNUNET_SYSERR;
}
- struct GNUNET_HashCode place_pub_hash;
- GNUNET_CRYPTO_hash (&ereq->place_pub_key, sizeof (ereq->place_pub_key), &place_pub_hash);
+ //struct GNUNET_HashCode place_pub_hash;
+ //GNUNET_CRYPTO_hash (&ereq->place_pub_key, sizeof (ereq->place_pub_key), &place_pub_hash);
- struct GNUNET_CONTAINER_MultiHashMap *
- place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
- if (NULL == place_apps)
- {
- place_apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
- if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (places_apps, &place_pub_hash, place_apps,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
- {
- GNUNET_break (0);
- }
- }
+ //struct GNUNET_CONTAINER_MultiHashMap *
+ // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
+ //if (NULL == place_apps)
+ //{
+ // place_apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
+ // if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (places_apps, &place_pub_hash, place_apps,
+ // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ // {
+ // GNUNET_break (0);
+ // }
+ //}
- size_t app_id_size = strlen (app_id) + 1;
- void *app_id_value = GNUNET_malloc (app_id_size);
- GNUNET_memcpy (app_id_value, app_id, app_id_size);
+ //size_t app_id_size = strlen (app_id) + 1;
+ //void *app_id_value = GNUNET_malloc (app_id_size);
+ //GNUNET_memcpy (app_id_value, app_id, app_id_size);
- if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
- {
- GNUNET_break (0);
- }
+ //if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (place_apps, &app_id_hash, app_id_value,
+ // GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
+ //{
+ // GNUNET_break (0);
+ //}
return GNUNET_OK;
}
app_place_save (const char *app_id,
const struct PlaceEnterRequest *ereq)
{
- app_place_add (app_id, ereq);
+ if (GNUNET_SYSERR == app_place_add (app_id, ereq))
+ {
+ GNUNET_assert (0);
+ }
if (NULL == dir_places)
return GNUNET_SYSERR;
if (NULL != app_places)
GNUNET_CONTAINER_multihashmap_remove (app_places, &place_pub_hash, NULL);
- struct GNUNET_CONTAINER_MultiHashMap *
- place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
- if (NULL != place_apps)
- {
- void *app_id_value = GNUNET_CONTAINER_multihashmap_get (place_apps, &app_id_hash);
- if (NULL != app_id_value)
- {
- GNUNET_CONTAINER_multihashmap_remove (place_apps, &app_id_hash, app_id_value);
- GNUNET_free (app_id_value);
- }
- }
+ //struct GNUNET_CONTAINER_MultiHashMap *
+ // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &place_pub_hash);
+ //if (NULL != place_apps)
+ //{
+ // void *app_id_value = GNUNET_CONTAINER_multihashmap_get (place_apps, &app_id_hash);
+ // if (NULL != app_id_value)
+ // {
+ // GNUNET_CONTAINER_multihashmap_remove (place_apps, &app_id_hash, app_id_value);
+ // GNUNET_free (app_id_value);
+ // }
+ //}
int ret = GNUNET_OK;
}
+void
+app_notify_place (const struct GNUNET_MessageHeader *msg,
+ struct GNUNET_SERVICE_Client *client)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%p Sending place notification of type %u to client.\n",
+ client, ntohs (msg->type));
+
+ uint16_t msg_size = ntohs (msg->size);
+ struct AppPlaceMessage amsg;
+ amsg.header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE);
+ amsg.header.size = htons (sizeof (amsg));
+ // FIXME: also notify about not entered places
+ amsg.place_state = GNUNET_SOCIAL_PLACE_STATE_ENTERED;
+
+ switch (ntohs (msg->type))
+ {
+ case GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER:
+ if (msg_size < sizeof (struct HostEnterRequest))
+ return;
+ struct HostEnterRequest *hreq = (struct HostEnterRequest *) msg;
+ amsg.is_host = GNUNET_YES;
+ amsg.ego_pub_key = hreq->ego_pub_key;
+ amsg.place_pub_key = hreq->place_pub_key;
+ break;
+
+ case GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER:
+ if (msg_size < sizeof (struct GuestEnterRequest))
+ return;
+ struct GuestEnterRequest *greq = (struct GuestEnterRequest *) msg;
+ amsg.is_host = GNUNET_NO;
+ amsg.ego_pub_key = greq->ego_pub_key;
+ amsg.place_pub_key = greq->place_pub_key;
+ break;
+
+ default:
+ return;
+ }
+
+ client_send_msg (client, &amsg.header);
+}
+
+
+void
+app_notify_place_end (struct GNUNET_SERVICE_Client *client)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%p Sending end of place list notification to client\n",
+ client);
+
+ struct GNUNET_MessageHeader msg;
+ msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END);
+ msg.size = htons (sizeof (msg));
+
+ client_send_msg (client, &msg);
+}
+
+
+void
+app_notify_ego (struct Ego *ego, struct GNUNET_SERVICE_Client *client)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "%p Sending ego notification to client: %s\n",
+ client, ego->name);
+
+ size_t name_size = strlen (ego->name) + 1;
+ struct AppEgoMessage *emsg = GNUNET_malloc (sizeof (*emsg) + name_size);
+ emsg->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO);
+ emsg->header.size = htons (sizeof (*emsg) + name_size);
+
+ GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
+ GNUNET_memcpy (&emsg[1], ego->name, name_size);
+
+ client_send_msg (client, &emsg->header);
+ GNUNET_free (emsg);
+}
+
+
+void
+app_notify_ego_end (struct GNUNET_SERVICE_Client *client)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%p Sending end of ego list notification to client\n",
+ client);
+
+ struct GNUNET_MessageHeader msg;
+ msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END);
+ msg.size = htons (sizeof (msg));
+
+ client_send_msg (client, &msg);
+}
+
+
+int
+app_place_entry_notify (void *cls, const struct GNUNET_HashCode *key, void *value)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "app_place_entry_notify\n");
+ struct GNUNET_MessageHeader *
+ msg = GNUNET_CONTAINER_multihashmap_get (places, key);
+ if (NULL != msg)
+ app_notify_place (msg, cls);
+ return GNUNET_YES;
+}
+
+
+int
+ego_entry (void *cls, const struct GNUNET_HashCode *key, void *value)
+{
+ app_notify_ego (value, cls);
+ return GNUNET_YES;
+}
+
+
static int
check_client_msg_proc_set (void *cls,
const struct MsgProcRequest *mpreq)
handle_client_host_enter (void *cls,
const struct HostEnterRequest *hr)
{
- struct Client *c = cls;
+ struct Client *c = cls;
struct GNUNET_SERVICE_Client *client = c->client;
struct HostEnterRequest *
hreq = (struct HostEnterRequest *) GNUNET_copy_message (&hr->header);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "handle_client_host_enter\n");
+
uint8_t app_id_size = ntohs (hreq->header.size) - sizeof (*hreq);
const char *app_id = NULL;
uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &hreq[1],
cli->client = client;
GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli);
c->place = plc;
+ app_notify_place (&hreq->header, client);
}
GNUNET_CRYPTO_eddsa_key_clear (&hreq->place_key);
struct Ego *ego = GNUNET_CONTAINER_multihashmap_get (egos, &ego_pub_hash);
if (NULL == ego)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "NULL == ego\n");
return GNUNET_SYSERR;
+ }
struct GNUNET_HashCode place_pub_hash;
GNUNET_CRYPTO_hash (&greq->place_pub_key, sizeof (greq->place_pub_key),
if (NULL != plc_gst)
gst = GNUNET_CONTAINER_multihashmap_get (plc_gst, &ego_pub_hash);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "guest enter, gst = %p\n",
+ gst);
+
if (NULL == gst || NULL == gst->slave)
{
gst = GNUNET_new (struct Guest);
struct GNUNET_PSYC_Message *join_msg = NULL;
uint16_t join_msg_size = 0;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "guest_enter 2\n");
+
if (sizeof (struct GNUNET_MessageHeader) <= remaining)
{
join_msg = (struct GNUNET_PSYC_Message *) p;
(void) GNUNET_CONTAINER_multihashmap_put (place_guests, &plc->pub_key_hash, plc_gst,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Adding guest %p\n",
+ gst);
(void) GNUNET_CONTAINER_multihashmap_put (plc_gst, &plc->ego_pub_hash, gst,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
(void) GNUNET_CONTAINER_multihashmap_put (guests, &plc->pub_key_hash, gst,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "GNUNET_PSYC_slave_join\n");
gst->slave
= GNUNET_PSYC_slave_join (cfg, &plc->pub_key, &plc->ego_key,
gst->join_flags, &gst->origin,
handle_client_guest_enter (void *cls,
const struct GuestEnterRequest *greq)
{
+ // FIXME: this must not be called directly by gns_result_guest_enter because then
+ // GNUNET_SERVICE_client_continue is called twice
struct Client *c = cls;
struct GNUNET_SERVICE_Client *client = c->client;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "handle_client_guest_enter\n");
+
uint16_t remaining = ntohs (greq->header.size) - sizeof (*greq);
const char *app_id = NULL;
uint16_t offset = GNUNET_STRINGS_buffer_tokenize ((const char *) &greq[1],
plc = c->place = &gst->place;
plc->guest = gst;
app_place_save (app_id, (const struct PlaceEnterRequest *) greq);
+ app_notify_place (&greq->header, client);
break;
case GNUNET_NO:
GNUNET_GNSRECORD_TYPE_PLACE,
GNUNET_GNS_LO_DEFAULT,
&gns_result_guest_enter, gcls);
-}
-
-
-void
-app_notify_place (struct GNUNET_MessageHeader *msg,
- struct GNUNET_SERVICE_Client *client)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%p Sending place notification of type %u to client.\n",
- client, ntohs (msg->type));
-
- uint16_t msg_size = ntohs (msg->size);
- struct AppPlaceMessage amsg;
- amsg.header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE);
- amsg.header.size = htons (sizeof (amsg));
- // FIXME: also notify about not entered places
- amsg.place_state = GNUNET_SOCIAL_PLACE_STATE_ENTERED;
-
- switch (ntohs (msg->type))
- {
- case GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER:
- if (msg_size < sizeof (struct HostEnterRequest))
- return;
- struct HostEnterRequest *hreq = (struct HostEnterRequest *) msg;
- amsg.is_host = GNUNET_YES;
- amsg.ego_pub_key = hreq->ego_pub_key;
- amsg.place_pub_key = hreq->place_pub_key;
- break;
-
- case GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER:
- if (msg_size < sizeof (struct GuestEnterRequest))
- return;
- struct GuestEnterRequest *greq = (struct GuestEnterRequest *) msg;
- amsg.is_host = GNUNET_NO;
- amsg.ego_pub_key = greq->ego_pub_key;
- amsg.place_pub_key = greq->place_pub_key;
- break;
-
- default:
- return;
- }
-
- client_send_msg (client, &amsg.header);
-}
-
-
-void
-app_notify_place_end (struct GNUNET_SERVICE_Client *client)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%p Sending end of place list notification to client\n",
- client);
-
- struct GNUNET_MessageHeader msg;
- msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_PLACE_END);
- msg.size = htons (sizeof (msg));
-
- client_send_msg (client, &msg);
-}
-
-
-void
-app_notify_ego (struct Ego *ego, struct GNUNET_SERVICE_Client *client)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%p Sending ego notification to client: %s\n",
- client, ego->name);
-
- size_t name_size = strlen (ego->name) + 1;
- struct AppEgoMessage *emsg = GNUNET_malloc (sizeof (*emsg) + name_size);
- emsg->header.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO);
- emsg->header.size = htons (sizeof (*emsg) + name_size);
-
- GNUNET_CRYPTO_ecdsa_key_get_public (&ego->key, &emsg->ego_pub_key);
- GNUNET_memcpy (&emsg[1], ego->name, name_size);
-
- client_send_msg (client, &emsg->header);
- GNUNET_free (emsg);
-}
-
-
-void
-app_notify_ego_end (struct GNUNET_SERVICE_Client *client)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%p Sending end of ego list notification to client\n",
- client);
-
- struct GNUNET_MessageHeader msg;
- msg.type = htons (GNUNET_MESSAGE_TYPE_SOCIAL_APP_EGO_END);
- msg.size = htons (sizeof (msg));
-
- client_send_msg (client, &msg);
-}
-
-
-int
-app_place_entry_notify (void *cls, const struct GNUNET_HashCode *key, void *value)
-{
- struct GNUNET_MessageHeader *
- msg = GNUNET_CONTAINER_multihashmap_get (places, key);
- if (NULL != msg)
- app_notify_place (msg, cls);
- return GNUNET_YES;
-}
-
-
-int
-ego_entry (void *cls, const struct GNUNET_HashCode *key, void *value)
-{
- app_notify_ego (value, cls);
- return GNUNET_YES;
+ GNUNET_SERVICE_client_continue (client);
}
struct GNUNET_HashCode app_id_hash;
GNUNET_CRYPTO_hash (app_id, app_id_size, &app_id_hash);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "iterating egos\n");
GNUNET_CONTAINER_multihashmap_iterate (egos, ego_entry, client);
app_notify_ego_end (client);
struct Client *c = cls;
struct GNUNET_SERVICE_Client *client = c->client;
struct Place *plc = c->place;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "handle_client_place_leave\n");
+
if (NULL == plc)
{
GNUNET_break (0);
/* FIXME: remove all app subscriptions and leave this place */
- struct GNUNET_CONTAINER_MultiHashMap *
- place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &plc->pub_key_hash);
- if (NULL != place_apps)
- {
- GNUNET_CONTAINER_multihashmap_iterate (place_apps, app_places_entry_remove, plc);
- }
+ //struct GNUNET_CONTAINER_MultiHashMap *
+ // place_apps = GNUNET_CONTAINER_multihashmap_get (places_apps, &plc->pub_key_hash);
+ //if (NULL != place_apps)
+ //{
+ // GNUNET_CONTAINER_multihashmap_iterate (place_apps, app_places_entry_remove, plc);
+ //}
/* FIXME: disconnect from the network, but keep local connection for history access */
cleanup_place (plc);
}
}
+ //GNUNET_SERVICE_client_continue (client);
}
struct OperationClosure *opcls = cls;
struct Client *c = opcls->client;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "namestore_recv_records_store_result\n");
// FIXME: client might have been disconnected
client_send_result (c->client, opcls->op_id, result, err_msg,
(NULL != err_msg) ? strlen (err_msg) : 0);
return GNUNET_OK;
}
- app_place_add (plcls->app_id, ereq);
+ if (GNUNET_SYSERR == app_place_add (plcls->app_id, ereq))
+ {
+ GNUNET_assert (0);
+ }
GNUNET_free (ereq);
return GNUNET_OK;
}
if (NULL == id_ego) // end of initial list of egos
return;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "social service received ego %s\n",
+ name);
+
struct GNUNET_CRYPTO_EcdsaPublicKey ego_pub_key;
GNUNET_IDENTITY_ego_get_public_key (id_ego, &ego_pub_key);
const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SERVICE_Handle *svc)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "starting social service\n");
+
cfg = c;
service = svc;
GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
apps = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
apps_places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
- places_apps = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
+ //places_apps = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
id = GNUNET_IDENTITY_connect (cfg, &identity_recv_ego, NULL);
gns = GNUNET_GNS_connect (cfg);
{
struct GNUNET_SOCIAL_Host *hst = cls;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "handle_host_enter_request\n");
+
if (NULL == hst->answer_door_cb)
return;
{
struct GNUNET_HashCode place_pub_hash;
GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"%s place cleanup: %s\n",
GNUNET_YES == plc->is_host ? "host" : "guest",
GNUNET_h2s (&place_pub_hash));
void
-place_disconnect (struct GNUNET_SOCIAL_Place *plc,
- GNUNET_ContinuationCallback cb,
- void *cls)
+place_disconnect (struct GNUNET_SOCIAL_Place *plc)
{
- plc->disconnect_cb = cb;
- plc->disconnect_cls = cls;
-
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "place_disconnect, plc = %p\n",
+ plc);
if (NULL != plc->mq)
{
struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq);
if (NULL != env)
{
- GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_cleanup, plc);
+ GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_disconnect, plc);
}
else
{
void
place_leave (struct GNUNET_SOCIAL_Place *plc)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "social_api: place_leave\n");
struct GNUNET_MessageHeader *msg;
struct GNUNET_MQ_Envelope *
env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SOCIAL_PLACE_LEAVE);
GNUNET_ContinuationCallback disconnect_cb,
void *cls)
{
- place_disconnect (&hst->plc, disconnect_cb, cls);
+ struct GNUNET_SOCIAL_Place *plc = &hst->plc;
+
+ plc->disconnect_cb = disconnect_cb;
+ plc->disconnect_cls = cls;
+ place_disconnect (plc);
}
GNUNET_ContinuationCallback disconnect_cb,
void *cls)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "GNUNET_SOCIAL_host_leave\n");
GNUNET_SOCIAL_host_announce (hst, "_notice_place_closing", env, NULL, NULL,
GNUNET_SOCIAL_ANNOUNCE_NONE);
place_leave (&hst->plc);
GNUNET_ContinuationCallback disconnect_cb,
void *cls)
{
- place_disconnect (&gst->plc, disconnect_cb, cls);
+ struct GNUNET_SOCIAL_Place *plc = &gst->plc;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "GNUNET_SOCIAL_guest_disconnect, gst = %p\n",
+ gst);
+ plc->disconnect_cb = disconnect_cb;
+ plc->disconnect_cls = cls;
+ place_disconnect (plc);
}
TEST_HOST_ANSWER_DOOR_REFUSE = 4,
TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5,
TEST_HOST_ANSWER_DOOR_ADMIT = 6,
- TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 9,
- TEST_HOST_ANNOUNCE = 10,
- TEST_HOST_ANNOUNCE_END = 11,
- TEST_GUEST_TALK = 12,
- TEST_HOST_ANNOUNCE2 = 13,
- TEST_HOST_ANNOUNCE2_END = 14,
- TEST_GUEST_HISTORY_REPLAY = 15,
- TEST_GUEST_HISTORY_REPLAY_LATEST = 16,
- TEST_GUEST_LOOK_AT = 17,
- TEST_GUEST_LOOK_FOR = 18,
- TEST_GUEST_LEAVE = 18,
- TEST_ZONE_ADD_PLACE = 20,
- TEST_GUEST_ENTER_BY_NAME = 21,
- TEST_RECONNECT = 22,
- TEST_GUEST_LEAVE2 = 23,
- TEST_HOST_LEAVE = 24,
+ TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 7,
+ TEST_HOST_ANNOUNCE = 8,
+ TEST_HOST_ANNOUNCE_END = 9,
+ TEST_GUEST_TALK = 10,
+ TEST_HOST_ANNOUNCE2 = 11,
+ TEST_HOST_ANNOUNCE2_END = 12,
+ TEST_GUEST_HISTORY_REPLAY = 13,
+ TEST_GUEST_HISTORY_REPLAY_LATEST = 14,
+ TEST_GUEST_LOOK_AT = 15,
+ TEST_GUEST_LOOK_FOR = 16,
+ TEST_GUEST_LEAVE = 17,
+ TEST_ZONE_ADD_PLACE = 18,
+ TEST_GUEST_ENTER_BY_NAME = 19,
+ TEST_RECONNECT = 20,
+ TEST_GUEST_LEAVE2 = 21,
+ TEST_HOST_LEAVE = 22,
} test;
static void
end ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Ending tests.\n", test);
if (end_badly_task != NULL)
{
struct TransmitClosure *tmit = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Transmission resumed.\n", test);
if (NULL != tmit->host_ann)
GNUNET_SOCIAL_host_announce_resume (tmit->host_ann);
}
uint16_t size = strlen (tmit->data[tmit->n]);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Transmit notify data: %u bytes available, "
"processing fragment %u/%u (size %u).\n",
test, *data_size, tmit->n + 1, tmit->data_count, size);
if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n])
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Transmission paused.\n", test);
tmit->paused = GNUNET_YES;
GNUNET_SCHEDULER_add_delayed (
static void
host_left ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: The host has left the place.\n", test);
end ();
}
{
place_pub_key = *home_pub_key;
GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host reconnected to place %s\n",
test, GNUNET_h2s (&place_pub_hash));
const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
uint64_t max_message_id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest reconnected to place: %d\n",
test, result);
GNUNET_assert (0 <= result);
static void
app_connected (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: App connected: %p\n", test, cls);
}
struct GNUNET_HashCode host_pub_hash;
GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Got app host place notification: %s\n",
test, GNUNET_h2s (&host_pub_hash));
{
if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Reconnecting to host place: %s\n",
test, GNUNET_h2s (&host_pub_hash));
hst = GNUNET_SOCIAL_host_enter_reconnect (hconn, host_slicer, host_reconnected,
struct GNUNET_HashCode guest_pub_hash;
GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Got app guest place notification: %s\n",
test, GNUNET_h2s (&guest_pub_hash));
{
if (0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Reconnecting to guest place: %s\n",
test, GNUNET_h2s (&guest_pub_hash));
gst = GNUNET_SOCIAL_guest_enter_reconnect (gconn, GNUNET_PSYC_SLAVE_JOIN_NONE,
{
host_ego = ego;
host_pub_key = ego_pub_key;
- GNUNET_assert (TEST_IDENTITIES_CREATE == test);
- enter_if_ready ();
+ if (TEST_IDENTITIES_CREATE == test)
+ {
+ enter_if_ready ();
+ }
+ else
+ {
+ GNUNET_assert (TEST_RECONNECT == test);
+ }
}
else if (NULL != strstr (name, guest_name))
{
guest_ego = ego;
guest_pub_key = ego_pub_key;
- GNUNET_assert (TEST_IDENTITIES_CREATE == test);
- enter_if_ready ();
+ if (TEST_IDENTITIES_CREATE == test)
+ {
+ enter_if_ready ();
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "test = %d\n",
+ test);
+ GNUNET_assert (TEST_RECONNECT == test);
+ }
}
}
host_recv_zone_add_place_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Zone add place result: %" PRId64 " (%.*s).\n",
test, result, data_size, (const char *) data);
GNUNET_assert (GNUNET_YES == result);
zone_add_place ()
{
test = TEST_ZONE_ADD_PLACE;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Adding place to zone.\n", test);
GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!",
nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym);
char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Farewell: nym %s (%s) has left the place.\n",
test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str);
GNUNET_free (str);
static void
guest_left (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: The guest has left the place.\n", test);
}
uint16_t data_size)
{
struct ResultClosure *rcls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: guest_look_for_result: %" PRId64 "\n",
test, result_code);
GNUNET_assert (GNUNET_OK == result_code);
- GNUNET_assert (3 == rcls->n);
+ GNUNET_assert (6 == rcls->n);
GNUNET_free (rcls);
GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL);
}
{
struct ResultClosure *rcls = cls;
rcls->n++;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: guest_look_for_var: %s\n%.*s\n",
test, name, value_size, (const char *) value);
}
{
struct ResultClosure *rcls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: guest_look_at_result: %" PRId64 "\n",
test, result_code);
GNUNET_assert (GNUNET_OK == result_code);
struct ResultClosure *rcls = cls;
rcls->n++;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: guest_look_at_var: %s\n%.*s\n",
test ,name, value_size, (const char *) value);
}
guest_recv_history_replay_latest_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received latest history replay result "
"(%" PRIu32 " messages, %" PRId64 " fragments):\n"
"%.*s\n",
guest_recv_history_replay_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received history replay result: %" PRId64 "\n"
"%.*s\n",
test, result, data_size, (const char *) data);
uint64_t message_id,
const char *method_name)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received method for message ID %" PRIu64 ":\n"
"%s (flags: %x)\n",
test, message_id, method_name, ntohl (meth->flags));
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received modifier for message ID %" PRIu64 ":\n"
"%c%s: %.*s (size: %u)\n",
test, message_id, oper, name, value_size, (const char *) value, value_size);
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received modifier matching _foo_bar for message ID %" PRIu64 ":\n"
"%c%s: %.*s (size: %u)\n",
test, message_id, oper, name, value_size, (const char *) value, value_size);
const void *data,
uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received data for message ID %" PRIu64 ":\n"
"%.*s\n",
test, message_id, data_size, (const char *) data);
uint64_t message_id,
uint8_t is_cancelled)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Guest received end of message ID %" PRIu64
", cancelled: %u\n",
test, message_id, is_cancelled);
uint64_t message_id,
const char *method_name)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received method for message ID %" PRIu64 ":\n"
"%s\n",
test, message_id, method_name);
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received modifier for message ID %" PRIu64 ":\n"
"%c%s: %.*s\n",
test, message_id, oper, name, value_size, (const char *) value);
const void *data,
uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received data for message ID %" PRIu64 ":\n"
"%.*s\n",
test, message_id, data_size, (const char *) data);
uint64_t message_id,
uint8_t is_cancelled)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received end of message ID %" PRIu64
", cancelled: %u\n",
test, message_id, is_cancelled);
{
test = TEST_HOST_ANNOUNCE;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host announcement.\n", test);
tmit = (struct TransmitClosure) {};
test = TEST_HOST_ANNOUNCE2;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host announcement 2.\n", test);
tmit = (struct TransmitClosure) {};
GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
"_foo2_bar", DATA2ARG ("FOO BAR"));
GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN,
- "_foo2_bar", DATA2ARG ("FOO BAR BAZ"));
+ "_foo2_bar_baz", DATA2ARG ("FOO BAR BAZ"));
tmit.data[0] = "AAA BBB CCC ";
tmit.data[1] = "ABC DEF GHI JKL.\n";
tmit.data[2] = "TESTING ONE TWO THREE.\n";
{
join_req_count++;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Host received entry request from guest (try %u).\n",
(uint8_t) test, join_req_count);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
guest_enter_by_name ()
{
test = TEST_GUEST_ENTER_BY_NAME;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Test #%u: Entering to place by name as guest.\n", test);
struct GuestEnterMessage *emsg = &guest_enter_msg;
{
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "starting app...\n");
app = GNUNET_SOCIAL_app_connect (cfg,
app_id,
app_recv_ego,