aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-29 11:27:32 +0100
committerChristian Grothoff <christian@grothoff.org>2017-10-29 11:27:32 +0100
commitca78392674d82d97832798f933b9c75f4e0af367 (patch)
treefbee5ffe56dcc168f251b43aef61742d6eb34d7e /src/social
parentcfd5e9d749ae8d9d07ef77943a9b560b491468fc (diff)
downloadgnunet-ca78392674d82d97832798f933b9c75f4e0af367.tar.gz
gnunet-ca78392674d82d97832798f933b9c75f4e0af367.zip
logging, cosmetic fixes
Diffstat (limited to 'src/social')
-rw-r--r--src/social/gnunet-service-social.c34
-rw-r--r--src/social/social_api.c3
-rw-r--r--src/social/test_social.conf3
3 files changed, 23 insertions, 17 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index f9e70a25d..04bbba192 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -570,7 +570,6 @@ client_notify_disconnect (void *cls,
570 570
571 if (NULL != c->app_id) 571 if (NULL != c->app_id)
572 GNUNET_free (c->app_id); 572 GNUNET_free (c->app_id);
573
574 GNUNET_free (c); 573 GNUNET_free (c);
575 574
576 if (NULL == plc) 575 if (NULL == plc)
@@ -586,7 +585,9 @@ client_notify_disconnect (void *cls,
586 { 585 {
587 if (cli->client == client) 586 if (cli->client == client)
588 { 587 {
589 GNUNET_CONTAINER_DLL_remove (plc->clients_head, plc->clients_tail, cli); 588 GNUNET_CONTAINER_DLL_remove (plc->clients_head,
589 plc->clients_tail,
590 cli);
590 GNUNET_free (cli); 591 GNUNET_free (cli);
591 break; 592 break;
592 } 593 }
@@ -608,11 +609,13 @@ client_notify_connect (void *cls,
608 struct GNUNET_SERVICE_Client *client, 609 struct GNUNET_SERVICE_Client *client,
609 struct GNUNET_MQ_Handle *mq) 610 struct GNUNET_MQ_Handle *mq)
610{ 611{
611 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client connected: %p\n", client); 612 struct Client *c = GNUNET_new (struct Client);
612 613
613 struct Client *c = GNUNET_malloc (sizeof (*c)); 614 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
615 "Client %p connected with queue %p\n",
616 client,
617 mq);
614 c->client = client; 618 c->client = client;
615
616 return c; 619 return c;
617} 620}
618 621
@@ -2204,7 +2207,7 @@ handle_client_app_detach (void *cls,
2204} 2207}
2205 2208
2206 2209
2207int 2210static int
2208app_places_entry_remove (void *cls, const struct GNUNET_HashCode *key, void *value) 2211app_places_entry_remove (void *cls, const struct GNUNET_HashCode *key, void *value)
2209{ 2212{
2210 struct Place *plc = cls; 2213 struct Place *plc = cls;
@@ -2247,15 +2250,14 @@ handle_client_place_leave (void *cls,
2247 /* FIXME: disconnect from the network, but keep local connection for history access */ 2250 /* FIXME: disconnect from the network, but keep local connection for history access */
2248 2251
2249 /* Disconnect all clients connected to the place */ 2252 /* Disconnect all clients connected to the place */
2250 struct ClientListItem *cli = plc->clients_head, *next; 2253
2251 while (NULL != cli) 2254 for (struct ClientListItem *cli = plc->clients_head;
2255 NULL != cli;
2256 cli = cli->next)
2252 { 2257 {
2253 GNUNET_CONTAINER_DLL_remove (plc->clients_head, plc->clients_tail, cli);
2254 // protocol design failure: should *tell* clients that room is gone! 2258 // protocol design failure: should *tell* clients that room is gone!
2255 GNUNET_SERVICE_client_drop (cli->client); 2259 if (client != cli->client)
2256 next = cli->next; 2260 GNUNET_SERVICE_client_drop (cli->client);
2257 GNUNET_free (cli);
2258 cli = next;
2259 } 2261 }
2260 2262
2261 if (GNUNET_YES != plc->is_disconnected) 2263 if (GNUNET_YES != plc->is_disconnected)
@@ -2268,10 +2270,11 @@ handle_client_place_leave (void *cls,
2268 else 2270 else
2269 { 2271 {
2270 cleanup_place (plc); 2272 cleanup_place (plc);
2273 c->place = NULL;
2271 } 2274 }
2272 } 2275 }
2273 // FIXME: can't continue+drop above, but should not drop above! 2276 // FIXME: can't continue+drop above, but should not drop above!
2274 // GNUNET_SERVICE_client_continue (client); 2277 GNUNET_SERVICE_client_continue (client);
2275} 2278}
2276 2279
2277 2280
@@ -2989,7 +2992,6 @@ handle_client_psyc_message (void *cls,
2989 "%p Received message with invalid payload size (%u) from client.\n", 2992 "%p Received message with invalid payload size (%u) from client.\n",
2990 plc, psize); 2993 plc, psize);
2991 GNUNET_break (0); 2994 GNUNET_break (0);
2992 psyc_transmit_cancel (plc, client);
2993 GNUNET_SERVICE_client_drop (client); 2995 GNUNET_SERVICE_client_drop (client);
2994 return; 2996 return;
2995 } 2997 }
@@ -3003,7 +3005,6 @@ handle_client_psyc_message (void *cls,
3003 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3005 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3004 "%p Received invalid message part from client.\n", plc); 3006 "%p Received invalid message part from client.\n", plc);
3005 GNUNET_break (0); 3007 GNUNET_break (0);
3006 psyc_transmit_cancel (plc, client);
3007 GNUNET_SERVICE_client_drop (client); 3008 GNUNET_SERVICE_client_drop (client);
3008 return; 3009 return;
3009 } 3010 }
@@ -3029,7 +3030,6 @@ handle_client_psyc_message (void *cls,
3029 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3030 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3030 "%p Received invalid message part from client.\n", plc); 3031 "%p Received invalid message part from client.\n", plc);
3031 GNUNET_break (0); 3032 GNUNET_break (0);
3032 psyc_transmit_cancel (plc, client);
3033 ret = GNUNET_SYSERR; 3033 ret = GNUNET_SYSERR;
3034 } 3034 }
3035 3035
diff --git a/src/social/social_api.c b/src/social/social_api.c
index fc649fcde..1db8e501a 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -1044,6 +1044,7 @@ static void
1044place_cleanup (struct GNUNET_SOCIAL_Place *plc) 1044place_cleanup (struct GNUNET_SOCIAL_Place *plc)
1045{ 1045{
1046 struct GNUNET_HashCode place_pub_hash; 1046 struct GNUNET_HashCode place_pub_hash;
1047
1047 GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash); 1048 GNUNET_CRYPTO_hash (&plc->pub_key, sizeof (plc->pub_key), &place_pub_hash);
1048 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1049 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1049 "%s place cleanup: %s\n", 1050 "%s place cleanup: %s\n",
@@ -2092,6 +2093,8 @@ leave_done_cont (void *cls)
2092{ 2093{
2093 struct LeaveContext *lc = cls; 2094 struct LeaveContext *lc = cls;
2094 2095
2096 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2097 "social_api: guest's place_leave message sent!\n");
2095 GNUNET_SOCIAL_guest_disconnect (lc->gst, 2098 GNUNET_SOCIAL_guest_disconnect (lc->gst,
2096 lc->disconnect_cb, 2099 lc->disconnect_cb,
2097 lc->disconnect_cb_cls); 2100 lc->disconnect_cb_cls);
diff --git a/src/social/test_social.conf b/src/social/test_social.conf
index 52ed20c6b..a11144b60 100644
--- a/src/social/test_social.conf
+++ b/src/social/test_social.conf
@@ -3,3 +3,6 @@
3[social] 3[social]
4AUTOSTART = YES 4AUTOSTART = YES
5FORCESTART = YES 5FORCESTART = YES
6
7[transport]
8PLUGINS = udp