diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-02 14:38:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-02 14:38:54 +0000 |
commit | 15a8471c0edc4134f57c19884c033a63f49a04dd (patch) | |
tree | 4465bb0b1198f1869163706e6cfeeaba5ff3fabf /src/regex/regex_api.c | |
parent | 2a453cf6aec60af36f655bd053847ab15ff7ae8f (diff) |
-implementing regex test
Diffstat (limited to 'src/regex/regex_api.c')
-rw-r--r-- | src/regex/regex_api.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c index fdfd050581..d51bd4c210 100644 --- a/src/regex/regex_api.c +++ b/src/regex/regex_api.c @@ -18,7 +18,7 @@ Boston, MA 02111-1307, USA. */ /** - * @file include/gnunet_regex_service.h + * @file regex/regex_api.c * @brief access regex service to advertise capabilities via regex and discover * respective peers using matching strings * @author Maximilian Szengel @@ -188,7 +188,7 @@ struct GNUNET_REGEX_Search /** * Search message to transmit to the service. */ - struct SearchMessage msg; + struct SearchMessage *msg; }; @@ -216,7 +216,7 @@ retry_search (struct GNUNET_REGEX_Search *s) GNUNET_assert (NULL != s->client); GNUNET_assert (GNUNET_OK == GNUNET_CLIENT_transmit_and_get_response (s->client, - &s->msg.header, + &s->msg->header, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &handle_search_response, @@ -300,16 +300,17 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, size_t slen; slen = strlen (string) + 1; - s = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Announcement) + slen); + s = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Search)); s->cfg = cfg; s->client = GNUNET_CLIENT_connect ("regex", cfg); if (NULL == s->client) return NULL; s->callback = callback; s->callback_cls = callback_cls; - s->msg.header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_SEARCH); - s->msg.header.size = htons (sizeof (struct SearchMessage) + slen); - memcpy (&s[1], string, slen); + s->msg = GNUNET_malloc (sizeof (struct SearchMessage) + slen); + s->msg->header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_SEARCH); + s->msg->header.size = htons (sizeof (struct SearchMessage) + slen); + memcpy (&s->msg[1], string, slen); retry_search (s); return s; } @@ -324,6 +325,7 @@ void GNUNET_REGEX_search_cancel (struct GNUNET_REGEX_Search *s) { GNUNET_CLIENT_disconnect (s->client); + GNUNET_free (s->msg); GNUNET_free (s); } |