diff options
author | lurchi <lurchi@strangeplace.net> | 2017-10-13 20:56:09 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-10-13 20:56:09 +0200 |
commit | 7478bbf75478b0df49ba06379888aae3632c2bf5 (patch) | |
tree | 4f1745a4a3c2bfdc3cedb2559402bce05eb6eb2c /src/social | |
parent | e3d4e018b5f7d4d3adc5a6cf4e0c2dbc42aa2448 (diff) | |
download | gnunet-7478bbf75478b0df49ba06379888aae3632c2bf5.tar.gz gnunet-7478bbf75478b0df49ba06379888aae3632c2bf5.zip |
don't call GNUNET_SERVICE_client_continue twice; maybe fix bug resulting from destroying MQ too early
Diffstat (limited to 'src/social')
-rw-r--r-- | src/social/gnunet-service-social.c | 60 | ||||
-rw-r--r-- | src/social/social_api.c | 5 |
2 files changed, 38 insertions, 27 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 30e113f18..f888564dc 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c | |||
@@ -1878,23 +1878,9 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst) | |||
1878 | 1878 | ||
1879 | 1879 | ||
1880 | static int | 1880 | static int |
1881 | check_client_guest_enter (void *cls, | 1881 | client_guest_enter (struct Client *c, |
1882 | const struct GuestEnterRequest *greq) | 1882 | const struct GuestEnterRequest *greq) |
1883 | { | ||
1884 | return GNUNET_OK; | ||
1885 | } | ||
1886 | |||
1887 | |||
1888 | /** | ||
1889 | * Handle a connecting client entering a place as guest. | ||
1890 | */ | ||
1891 | static void | ||
1892 | handle_client_guest_enter (void *cls, | ||
1893 | const struct GuestEnterRequest *greq) | ||
1894 | { | 1883 | { |
1895 | // FIXME: this must not be called directly by gns_result_guest_enter because then | ||
1896 | // GNUNET_SERVICE_client_continue is called twice | ||
1897 | struct Client *c = cls; | ||
1898 | struct GNUNET_SERVICE_Client *client = c->client; | 1884 | struct GNUNET_SERVICE_Client *client = c->client; |
1899 | 1885 | ||
1900 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1886 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -1906,9 +1892,7 @@ handle_client_guest_enter (void *cls, | |||
1906 | remaining, 1, &app_id); | 1892 | remaining, 1, &app_id); |
1907 | if (0 == offset) | 1893 | if (0 == offset) |
1908 | { | 1894 | { |
1909 | GNUNET_break (0); | 1895 | return GNUNET_SYSERR; |
1910 | GNUNET_SERVICE_client_drop (client); | ||
1911 | return; | ||
1912 | } | 1896 | } |
1913 | 1897 | ||
1914 | struct Guest *gst = NULL; | 1898 | struct Guest *gst = NULL; |
@@ -1941,9 +1925,7 @@ handle_client_guest_enter (void *cls, | |||
1941 | break; | 1925 | break; |
1942 | } | 1926 | } |
1943 | case GNUNET_SYSERR: | 1927 | case GNUNET_SYSERR: |
1944 | GNUNET_break (0); | 1928 | return GNUNET_SYSERR; |
1945 | GNUNET_SERVICE_client_drop (client); | ||
1946 | return; | ||
1947 | } | 1929 | } |
1948 | 1930 | ||
1949 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1931 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1953,9 +1935,36 @@ handle_client_guest_enter (void *cls, | |||
1953 | struct ClientListItem *cli = GNUNET_new (struct ClientListItem); | 1935 | struct ClientListItem *cli = GNUNET_new (struct ClientListItem); |
1954 | cli->client = client; | 1936 | cli->client = client; |
1955 | GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli); | 1937 | GNUNET_CONTAINER_DLL_insert (plc->clients_head, plc->clients_tail, cli); |
1938 | return GNUNET_OK; | ||
1939 | } | ||
1956 | 1940 | ||
1957 | c->place = plc; | 1941 | |
1958 | GNUNET_SERVICE_client_continue (client); | 1942 | static int |
1943 | check_client_guest_enter (void *cls, | ||
1944 | const struct GuestEnterRequest *greq) | ||
1945 | { | ||
1946 | return GNUNET_OK; | ||
1947 | } | ||
1948 | |||
1949 | |||
1950 | /** | ||
1951 | * Handle a connecting client entering a place as guest. | ||
1952 | */ | ||
1953 | static void | ||
1954 | handle_client_guest_enter (void *cls, | ||
1955 | const struct GuestEnterRequest *greq) | ||
1956 | { | ||
1957 | // FIXME: this must not be called directly by gns_result_guest_enter because then | ||
1958 | // GNUNET_SERVICE_client_continue is called twice | ||
1959 | struct Client *c = cls; | ||
1960 | |||
1961 | if (GNUNET_SYSERR == client_guest_enter (c, greq)) | ||
1962 | { | ||
1963 | GNUNET_break (0); | ||
1964 | GNUNET_SERVICE_client_drop (c->client); | ||
1965 | return; | ||
1966 | } | ||
1967 | GNUNET_SERVICE_client_continue (c->client); | ||
1959 | } | 1968 | } |
1960 | 1969 | ||
1961 | 1970 | ||
@@ -2032,7 +2041,7 @@ gns_result_guest_enter (void *cls, uint32_t rd_count, | |||
2032 | p += relay_size; | 2041 | p += relay_size; |
2033 | GNUNET_memcpy (p, gcls->join_msg, join_msg_size); | 2042 | GNUNET_memcpy (p, gcls->join_msg, join_msg_size); |
2034 | 2043 | ||
2035 | handle_client_guest_enter (c, greq); | 2044 | client_guest_enter (c, greq); |
2036 | 2045 | ||
2037 | GNUNET_free (gcls->app_id); | 2046 | GNUNET_free (gcls->app_id); |
2038 | if (NULL != gcls->password) | 2047 | if (NULL != gcls->password) |
@@ -2261,6 +2270,7 @@ handle_client_place_leave (void *cls, | |||
2261 | } | 2270 | } |
2262 | } | 2271 | } |
2263 | //GNUNET_SERVICE_client_continue (client); | 2272 | //GNUNET_SERVICE_client_continue (client); |
2273 | //GNUNET_SERVICE_client_drop (client); | ||
2264 | } | 2274 | } |
2265 | 2275 | ||
2266 | 2276 | ||
diff --git a/src/social/social_api.c b/src/social/social_api.c index 04b671120..a190b2f26 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -1085,9 +1085,10 @@ place_disconnect (struct GNUNET_SOCIAL_Place *plc) | |||
1085 | plc); | 1085 | plc); |
1086 | if (NULL != plc->mq) | 1086 | if (NULL != plc->mq) |
1087 | { | 1087 | { |
1088 | 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); |
1089 | if (NULL != env) | 1089 | if (GNUNET_MQ_get_length (plc->mq) > 0) |
1090 | { | 1090 | { |
1091 | struct GNUNET_MQ_Envelope *env = GNUNET_MQ_get_last_envelope (plc->mq); | ||
1091 | GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_disconnect, plc); | 1092 | GNUNET_MQ_notify_sent (env, (GNUNET_SCHEDULER_TaskCallback) place_disconnect, plc); |
1092 | } | 1093 | } |
1093 | else | 1094 | else |