From: Matthias Wachs Date: Thu, 27 May 2010 13:57:41 +0000 (+0000) Subject: (no commit message) X-Git-Tag: initial-import-from-subversion-38251~21544 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e8714d39bb986c9b2c36167b015ea03035cc8c70;p=oweals%2Fgnunet.git --- diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index 572e6182b..d9282218b 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c @@ -52,7 +52,7 @@ /** * How long until we give up on transmitting the message? */ -#define STAT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) +#define STAT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) /** * Our public key. @@ -111,11 +111,12 @@ static struct GNUNET_TRANSPORT_PluginFunctions *api; */ static GNUNET_SCHEDULER_TaskIdentifier ti_timeout; -#if 0 -static GNUNET_SCHEDULER_TaskIdentifier ti_download; -#endif + +static GNUNET_SCHEDULER_TaskIdentifier ti_send; static unsigned int timeout_count; +static unsigned int recieved; +const struct GNUNET_PeerIdentity * p; /** * Did the test pass or fail? @@ -126,6 +127,22 @@ static int fail; pid_t pid; +static void +task_send (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + ti_timeout = GNUNET_SCHEDULER_NO_TASK; + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) + return; + + struct GNUNET_MessageHeader * msg = cls; + unsigned int len = ntohs(msg->size); + const char * msgc = (const char *) msg; + + api->send(api->cls,p,msgc, len, 0, TIMEOUT, NULL,NULL, 0, GNUNET_NO, NULL, NULL); + +} + /** * Initialize Environment for this plugin */ @@ -140,6 +157,13 @@ receive (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testcase recieved new message from peer `%s' with type %u and length %u\n", GNUNET_i2s(peer),ntohs(message->type),ntohs(message->size)); + + + recieved = GNUNET_YES; + p = peer; + void * c = (void *) message; + + ti_send =GNUNET_SCHEDULER_add_delayed (sched, STAT_INTERVALL, &task_send, c); return GNUNET_TIME_UNIT_ZERO; } @@ -229,6 +253,8 @@ cont_func (void *cls, int success) } #endif + + /** * Task that checks if we should try to download a hostlist. * If so, we initiate the download, otherwise we schedule