summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-08-18 14:41:03 +0000
committerGabor X Toth <*@tg-x.net>2016-08-18 14:41:03 +0000
commita50f647a3892357556f93a559b3dad35517dcca0 (patch)
tree27713fbe9d3d23902fc523740e4f5d9315d71807
parent7f937e3781f36538d9864fa841822eecdaf0bf27 (diff)
social: debug msgs
-rw-r--r--src/social/social_api.c8
-rw-r--r--src/social/test_social.c143
2 files changed, 83 insertions, 68 deletions
diff --git a/src/social/social_api.c b/src/social/social_api.c
index 583ce6d1e..f73ae17df 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -1067,11 +1067,11 @@ place_cleanup (struct GNUNET_SOCIAL_Place *plc)
void
place_disconnect (struct GNUNET_SOCIAL_Place *plc,
- GNUNET_ContinuationCallback disconnect_cb,
- void *disconnect_cls)
+ GNUNET_ContinuationCallback cb,
+ void *cls)
{
- plc->disconnect_cb = disconnect_cb;
- plc->disconnect_cls = disconnect_cls;
+ plc->disconnect_cb = cb;
+ plc->disconnect_cls = cls;
if (NULL != plc->mq)
{
diff --git a/src/social/test_social.c b/src/social/test_social.c
index 6de31eb83..5ab6c83fa 100644
--- a/src/social/test_social.c
+++ b/src/social/test_social.c
@@ -260,7 +260,8 @@ end_normally (void *cls)
static void
end ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending tests.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Ending tests.\n", test);
if (end_badly_task != NULL)
{
@@ -276,8 +277,8 @@ transmit_resume (void *cls)
{
struct TransmitClosure *tmit = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission resumed.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Transmission resumed.\n", test);
if (NULL != tmit->host_ann)
GNUNET_SOCIAL_host_announce_resume (tmit->host_ann);
else
@@ -301,10 +302,10 @@ notify_data (void *cls, uint16_t *data_size, void *data)
}
uint16_t size = strlen (tmit->data[tmit->n]);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmit notify data: %u bytes available, "
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Transmit notify data: %u bytes available, "
"processing fragment %u/%u (size %u).\n",
- *data_size, tmit->n + 1, tmit->data_count, size);
+ test, *data_size, tmit->n + 1, tmit->data_count, size);
if (*data_size < size)
{
*data_size = 0;
@@ -314,7 +315,8 @@ notify_data (void *cls, uint16_t *data_size, void *data)
if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n])
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission paused.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Transmission paused.\n", test);
tmit->paused = GNUNET_YES;
GNUNET_SCHEDULER_add_delayed (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
@@ -335,8 +337,8 @@ notify_data (void *cls, uint16_t *data_size, void *data)
static void
host_left ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "The host has left the place.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: The host has left the place.\n", test);
end ();
}
@@ -369,7 +371,7 @@ host_reconnected (void *cls, int result,
{
place_pub_key = *home_pub_key;
GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host reconnected to place %s\n",
test, GNUNET_h2s (&place_pub_hash));
@@ -386,7 +388,7 @@ guest_reconnected (void *cls, int result,
const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
uint64_t max_message_id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest reconnected to place: %d\n",
test, result);
GNUNET_assert (0 <= result);
@@ -402,8 +404,8 @@ guest_reconnected (void *cls, int result,
static void
app_connected (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "App connected: %p\n", cls);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: App connected: %p\n", test, cls);
if (NULL != core)
{
GNUNET_CORE_disconnecT (core);
@@ -422,14 +424,17 @@ app_recv_host (void *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_DEBUG,
- "Got app host place notification: %s\n",
- GNUNET_h2s (&host_pub_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Got app host place notification: %s\n",
+ test, GNUNET_h2s (&host_pub_hash));
if (test == TEST_RECONNECT)
{
if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key)))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "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,
host_answer_door, host_farewell2, NULL);
}
@@ -447,14 +452,17 @@ app_recv_guest (void *cls,
struct GNUNET_HashCode guest_pub_hash;
GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got app guest place notification: %s\n",
- GNUNET_h2s (&guest_pub_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Got app guest place notification: %s\n",
+ test, GNUNET_h2s (&guest_pub_hash));
if (test == TEST_RECONNECT)
{
if (0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key)))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "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,
guest_slicer, guest_reconnected, NULL);
}
@@ -469,9 +477,9 @@ app_recv_ego (void *cls,
const char *name)
{
char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Got app ego notification: %p %s %s\n",
- ego, name, ego_pub_str);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Got app ego notification: %p %s %s\n",
+ test, ego, name, ego_pub_str);
GNUNET_free (ego_pub_str);
if (NULL != strstr (name, host_name) && TEST_HOST_CREATE == test)
@@ -515,7 +523,7 @@ static void
host_recv_zone_add_place_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Zone add place result: %" PRId64 " (%.*s).\n",
test, result, data_size, (const char *) data);
GNUNET_assert (GNUNET_YES == result);
@@ -529,7 +537,7 @@ static void
zone_add_place ()
{
test = TEST_ZONE_ADD_PLACE;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Adding place to zone.\n", test);
GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!",
@@ -548,16 +556,17 @@ host_farewell (void *cls,
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_WARNING,
- "Farewell: nym %s (%s) has left the place.\n",
- GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "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);
GNUNET_assert (1 == GNUNET_PSYC_env_get_count (env));
if (0 != memcmp (&guest_pub_key, nym_key, sizeof (*nym_key)))
{
str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&guest_pub_key);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Farewell: nym does not match guest: %s\n", str);
+ "Test #%u: Farewell: nym does not match guest: %s\n",
+ test, str);
GNUNET_free (str);
GNUNET_assert (0);
}
@@ -568,8 +577,8 @@ host_farewell (void *cls,
static void
guest_left (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "The guest has left the place.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: The guest has left the place.\n", test);
}
@@ -605,8 +614,9 @@ guest_look_for_result (void *cls,
uint16_t data_size)
{
struct ResultClosure *rcls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "guest_look_for_result: %" PRId64 "\n", result_code);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: guest_look_for_result: %" PRId64 "\n",
+ test, result_code);
GNUNET_assert (GNUNET_OK == result_code);
GNUNET_assert (3 == rcls->n);
GNUNET_free (rcls);
@@ -624,9 +634,9 @@ guest_look_for_var (void *cls,
{
struct ResultClosure *rcls = cls;
rcls->n++;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "guest_look_for_var: %s\n%.*s\n",
- name, value_size, (const char *) value);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: guest_look_for_var: %s\n%.*s\n",
+ test, name, value_size, (const char *) value);
}
@@ -645,8 +655,9 @@ guest_look_at_result (void *cls, int64_t result_code,
{
struct ResultClosure *rcls = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "guest_look_at_result: %" PRId64 "\n", result_code);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: guest_look_at_result: %" PRId64 "\n",
+ test, result_code);
GNUNET_assert (GNUNET_OK == result_code);
GNUNET_assert (1 == rcls->n);
GNUNET_free (rcls);
@@ -665,9 +676,9 @@ guest_look_at_var (void *cls,
struct ResultClosure *rcls = cls;
rcls->n++;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "guest_look_at_var: %s\n%.*s\n",
- name, value_size, (const char *) value);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: guest_look_at_var: %s\n%.*s\n",
+ test ,name, value_size, (const char *) value);
}
@@ -684,7 +695,7 @@ static void
guest_recv_history_replay_latest_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received latest history replay result "
"(%" PRIu32 " messages, %" PRId64 " fragments):\n"
"%.*s\n",
@@ -713,7 +724,7 @@ static void
guest_recv_history_replay_result (void *cls, int64_t result,
const void *data, uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received history replay result: %" PRId64 "\n"
"%.*s\n",
test, result, data_size, (const char *) data);
@@ -744,7 +755,7 @@ guest_recv_method (void *cls,
uint64_t message_id,
const char *method_name)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received method for message ID %" PRIu64 ":\n"
"%s (flags: %x)\n",
test, message_id, method_name, ntohl (meth->flags));
@@ -763,7 +774,7 @@ guest_recv_modifier (void *cls,
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"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);
@@ -781,7 +792,7 @@ guest_recv_mod_foo_bar (void *cls,
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"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);
@@ -799,7 +810,7 @@ guest_recv_data (void *cls,
const void *data,
uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received data for message ID %" PRIu64 ":\n"
"%.*s\n",
test, message_id, data_size, (const char *) data);
@@ -814,7 +825,7 @@ guest_recv_eom (void *cls,
uint64_t message_id,
uint8_t is_cancelled)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received end of message ID %" PRIu64
", cancelled: %u\n",
test, message_id, is_cancelled);
@@ -856,7 +867,7 @@ host_recv_method (void *cls,
uint64_t message_id,
const char *method_name)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host received method for message ID %" PRIu64 ":\n"
"%s\n",
test, message_id, method_name);
@@ -875,7 +886,7 @@ host_recv_modifier (void *cls,
uint16_t value_size,
uint16_t full_value_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host received modifier for message ID %" PRIu64 ":\n"
"%c%s: %.*s\n",
test, message_id, oper, name, value_size, (const char *) value);
@@ -890,7 +901,7 @@ host_recv_data (void *cls,
const void *data,
uint16_t data_size)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host received data for message ID %" PRIu64 ":\n"
"%.*s\n",
test, message_id, data_size, (const char *) data);
@@ -904,7 +915,7 @@ host_recv_eom (void *cls,
uint64_t message_id,
uint8_t is_cancelled)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host received end of message ID %" PRIu64
", cancelled: %u\n",
test, message_id, is_cancelled);
@@ -934,7 +945,7 @@ host_recv_eom (void *cls,
default:
if (TEST_GUEST_LEAVE <= test)
break;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "invalid test: %d\n", test);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Invalid test: #%u\n", test);
GNUNET_assert (0);
}
}
@@ -969,7 +980,7 @@ host_announce ()
{
test = TEST_HOST_ANNOUNCE;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host announcement.\n", test);
tmit = (struct TransmitClosure) {};
@@ -1003,7 +1014,7 @@ host_announce2 ()
test = TEST_HOST_ANNOUNCE2;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host announcement 2.\n", test);
tmit = (struct TransmitClosure) {};
@@ -1031,7 +1042,7 @@ guest_recv_entry_decision (void *cls,
int is_admitted,
const struct GNUNET_PSYC_Message *entry_msg)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest received entry decision (try %u): %d.\n",
test, join_req_count, is_admitted);
@@ -1085,7 +1096,7 @@ host_answer_door (void *cls,
{
join_req_count++;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Host received entry request from guest (try %u).\n",
(uint8_t) test, join_req_count);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1123,7 +1134,7 @@ guest_recv_local_enter (void *cls, int result,
const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key,
uint64_t max_message_id)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Guest entered to local place: %d\n",
test, result);
GNUNET_assert (0 <= result);
@@ -1133,7 +1144,7 @@ guest_recv_local_enter (void *cls, int result,
static void
guest_enter ()
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Entering to place as guest.\n", test);
struct GuestEnterMessage *emsg = &guest_enter_msg;
@@ -1165,7 +1176,7 @@ static void
guest_enter_by_name ()
{
test = TEST_GUEST_ENTER_BY_NAME;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Test #%u: Entering to place by name as guest.\n", test);
struct GuestEnterMessage *emsg = &guest_enter_msg;
@@ -1225,7 +1236,8 @@ id_guest_created (void *cls, const char *emsg)
if (NULL != emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not create guest identity: %s\n", emsg);
+ "Test #%u: Could not create guest identity: %s\n",
+ test, emsg);
#if ! DEBUG_TEST_SOCIAL
GNUNET_assert (0);
#endif
@@ -1242,8 +1254,9 @@ host_entered (void *cls, int result,
{
place_pub_key = *home_pub_key;
GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Host entered to place %s\n", GNUNET_h2s (&place_pub_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Host entered to place %s\n",
+ test, GNUNET_h2s (&place_pub_hash));
test = TEST_GUEST_CREATE;
GNUNET_IDENTITY_create (id, guest_name, &id_guest_created, NULL);
@@ -1258,7 +1271,8 @@ host_enter ()
host_recv_method, host_recv_modifier,
host_recv_data, host_recv_eom, NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Entering to place as host.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test #%u: Entering to place as host.\n", test);
test = TEST_HOST_ENTER;
hst = GNUNET_SOCIAL_host_enter (app, host_ego,
GNUNET_PSYC_CHANNEL_PRIVATE,
@@ -1277,7 +1291,8 @@ id_host_created (void *cls, const char *emsg)
if (NULL != emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not create host identity: %s\n", emsg);
+ "Test #%u: Could not create host identity: %s\n",
+ test, emsg);
#if ! DEBUG_TEST_SOCIAL
GNUNET_assert (0);
#endif