diff options
author | lurchi <lurchi@strangeplace.net> | 2017-12-30 19:10:40 +0100 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-12-30 19:10:40 +0100 |
commit | 682bf4377d630f63912c0cdc7f612e9df9c82a33 (patch) | |
tree | f0739e8b39d2ab828e09749a4644321fe8247017 /src/social | |
parent | cc77132e6ab0b35c3ecad0b3ca99a79662778ece (diff) | |
download | gnunet-682bf4377d630f63912c0cdc7f612e9df9c82a33.tar.gz gnunet-682bf4377d630f63912c0cdc7f612e9df9c82a33.zip |
consider entry decision while re-entering a place
Diffstat (limited to 'src/social')
-rw-r--r-- | src/social/social_api.c | 109 |
1 files changed, 58 insertions, 51 deletions
diff --git a/src/social/social_api.c b/src/social/social_api.c index 4e305b867..48e376404 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -1921,52 +1921,52 @@ struct ReconnectContext | |||
1921 | }; | 1921 | }; |
1922 | 1922 | ||
1923 | 1923 | ||
1924 | //static void | 1924 | static void |
1925 | //guest_enter_reconnect_cb (void *cls, | 1925 | guest_enter_reconnect_cb (void *cls, |
1926 | // int result, | 1926 | int result, |
1927 | // const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, | 1927 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, |
1928 | // uint64_t max_message_id) | 1928 | uint64_t max_message_id) |
1929 | //{ | 1929 | { |
1930 | // struct ReconnectContext *reconnect_ctx = cls; | 1930 | struct ReconnectContext *reconnect_ctx = cls; |
1931 | // | 1931 | |
1932 | // GNUNET_assert (NULL != reconnect_ctx); | 1932 | GNUNET_assert (NULL != reconnect_ctx); |
1933 | // reconnect_ctx->result = GNUNET_new (int); | 1933 | reconnect_ctx->result = GNUNET_new (int); |
1934 | // *(reconnect_ctx->result) = result; | 1934 | *(reconnect_ctx->result) = result; |
1935 | // reconnect_ctx->max_message_id = GNUNET_new (int64_t); | 1935 | reconnect_ctx->max_message_id = GNUNET_new (int64_t); |
1936 | // *(reconnect_ctx->max_message_id) = max_message_id; | 1936 | *(reconnect_ctx->max_message_id) = max_message_id; |
1937 | //} | 1937 | } |
1938 | // | 1938 | |
1939 | // | 1939 | |
1940 | //static void | 1940 | static void |
1941 | //guest_entry_dcsn_reconnect_cb (void *cls, | 1941 | guest_entry_dcsn_reconnect_cb (void *cls, |
1942 | // int is_admitted, | 1942 | int is_admitted, |
1943 | // const struct GNUNET_PSYC_Message *entry_resp) | 1943 | const struct GNUNET_PSYC_Message *entry_resp) |
1944 | //{ | 1944 | { |
1945 | // struct ReconnectContext *reconnect_ctx = cls; | 1945 | struct ReconnectContext *reconnect_ctx = cls; |
1946 | // struct GNUNET_SOCIAL_Guest *gst = reconnect_ctx->guest; | 1946 | struct GNUNET_SOCIAL_Guest *gst = reconnect_ctx->guest; |
1947 | // | 1947 | |
1948 | // GNUNET_assert (NULL != reconnect_ctx); | 1948 | GNUNET_assert (NULL != reconnect_ctx); |
1949 | // GNUNET_assert (NULL != reconnect_ctx->result); | 1949 | GNUNET_assert (NULL != reconnect_ctx->result); |
1950 | // GNUNET_assert (NULL != reconnect_ctx->max_message_id); | 1950 | GNUNET_assert (NULL != reconnect_ctx->max_message_id); |
1951 | // if (GNUNET_YES != is_admitted) | 1951 | if (GNUNET_YES != is_admitted) |
1952 | // { | 1952 | { |
1953 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1953 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1954 | // "Guest was rejected after calling " | 1954 | "Guest was rejected after calling " |
1955 | // "GNUNET_SOCIAL_guest_enter_reconnect ()\n"); | 1955 | "GNUNET_SOCIAL_guest_enter_reconnect ()\n"); |
1956 | // } | 1956 | } |
1957 | // else if (NULL != reconnect_ctx->enter_cb) | 1957 | else if (NULL != reconnect_ctx->enter_cb) |
1958 | // { | 1958 | { |
1959 | // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1960 | // "guest reconnected!\n"); | 1960 | "guest reconnected!\n"); |
1961 | // reconnect_ctx->enter_cb (reconnect_ctx->enter_cls, | 1961 | reconnect_ctx->enter_cb (reconnect_ctx->enter_cls, |
1962 | // *(reconnect_ctx->result), | 1962 | *(reconnect_ctx->result), |
1963 | // &gst->plc.pub_key, | 1963 | &gst->plc.pub_key, |
1964 | // *(reconnect_ctx->max_message_id)); | 1964 | *(reconnect_ctx->max_message_id)); |
1965 | // } | 1965 | } |
1966 | // GNUNET_free (reconnect_ctx->result); | 1966 | GNUNET_free (reconnect_ctx->result); |
1967 | // GNUNET_free (reconnect_ctx->max_message_id); | 1967 | GNUNET_free (reconnect_ctx->max_message_id); |
1968 | // GNUNET_free (reconnect_ctx); | 1968 | GNUNET_free (reconnect_ctx); |
1969 | //} | 1969 | } |
1970 | 1970 | ||
1971 | 1971 | ||
1972 | /** | 1972 | /** |
@@ -1979,8 +1979,8 @@ struct ReconnectContext | |||
1979 | * Flags for the entry. | 1979 | * Flags for the entry. |
1980 | * @param slicer | 1980 | * @param slicer |
1981 | * Slicer to use for processing incoming requests from guests. | 1981 | * Slicer to use for processing incoming requests from guests. |
1982 | * @param local_enter_cb | 1982 | * @param enter_cb |
1983 | * Called upon connection established to the social service. | 1983 | * Called upon re-entering is complete. |
1984 | * @param entry_decision_cb | 1984 | * @param entry_decision_cb |
1985 | * Called upon receiving entry decision. | 1985 | * Called upon receiving entry decision. |
1986 | * | 1986 | * |
@@ -1990,11 +1990,12 @@ struct GNUNET_SOCIAL_Guest * | |||
1990 | GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn, | 1990 | GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn, |
1991 | enum GNUNET_PSYC_SlaveJoinFlags flags, | 1991 | enum GNUNET_PSYC_SlaveJoinFlags flags, |
1992 | struct GNUNET_PSYC_Slicer *slicer, | 1992 | struct GNUNET_PSYC_Slicer *slicer, |
1993 | GNUNET_SOCIAL_GuestEnterCallback local_enter_cb, | 1993 | GNUNET_SOCIAL_GuestEnterCallback enter_cb, |
1994 | void *cls) | 1994 | void *cls) |
1995 | { | 1995 | { |
1996 | struct GNUNET_SOCIAL_Guest *gst = GNUNET_malloc (sizeof (*gst)); | 1996 | struct GNUNET_SOCIAL_Guest *gst = GNUNET_malloc (sizeof (*gst)); |
1997 | struct GNUNET_SOCIAL_Place *plc = &gst->plc; | 1997 | struct GNUNET_SOCIAL_Place *plc = &gst->plc; |
1998 | struct ReconnectContext *reconnect_ctx; | ||
1998 | 1999 | ||
1999 | uint16_t app_id_size = strlen (gconn->app->id) + 1; | 2000 | uint16_t app_id_size = strlen (gconn->app->id) + 1; |
2000 | struct GuestEnterRequest *greq; | 2001 | struct GuestEnterRequest *greq; |
@@ -2013,9 +2014,15 @@ GNUNET_SOCIAL_guest_enter_reconnect (struct GNUNET_SOCIAL_GuestConnection *gconn | |||
2013 | plc->pub_key = gconn->plc_msg.place_pub_key; | 2014 | plc->pub_key = gconn->plc_msg.place_pub_key; |
2014 | plc->ego_pub_key = gconn->plc_msg.ego_pub_key; | 2015 | plc->ego_pub_key = gconn->plc_msg.ego_pub_key; |
2015 | 2016 | ||
2017 | reconnect_ctx = GNUNET_new (struct ReconnectContext); | ||
2018 | reconnect_ctx->guest = gst; | ||
2019 | reconnect_ctx->enter_cb = enter_cb; | ||
2020 | reconnect_ctx->enter_cls = cls; | ||
2021 | |||
2016 | plc->op = GNUNET_OP_create (); | 2022 | plc->op = GNUNET_OP_create (); |
2017 | gst->enter_cb = local_enter_cb; | 2023 | gst->enter_cb = &guest_enter_reconnect_cb; |
2018 | gst->cb_cls = cls; | 2024 | gst->entry_dcsn_cb = &guest_entry_dcsn_reconnect_cb; |
2025 | gst->cb_cls = reconnect_ctx; | ||
2019 | 2026 | ||
2020 | guest_connect (gst); | 2027 | guest_connect (gst); |
2021 | return gst; | 2028 | return gst; |