diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-06-01 14:14:57 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-06-01 14:14:57 +0000 |
commit | 1054ad5bb70200162c50a2c390cd543f69d9f8f2 (patch) | |
tree | 0486b2f9dee633c1bd238744def2db6dd97a76e0 /src/transport/test_plugin_transport_http.c | |
parent | bfcc2705ca4a4eabb389c3694829bf697c9b9da3 (diff) | |
download | gnunet-1054ad5bb70200162c50a2c390cd543f69d9f8f2.tar.gz gnunet-1054ad5bb70200162c50a2c390cd543f69d9f8f2.zip |
Diffstat (limited to 'src/transport/test_plugin_transport_http.c')
-rw-r--r-- | src/transport/test_plugin_transport_http.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index dbbb91e36..64f3f510e 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #define VERBOSE GNUNET_YES | 42 | #define VERBOSE GNUNET_YES |
43 | #define DEBUG GNUNET_YES | 43 | #define DEBUG GNUNET_YES |
44 | #define DEBUG_CURL GNUNET_NO | ||
44 | 45 | ||
45 | #define PLUGIN libgnunet_plugin_transport_template | 46 | #define PLUGIN libgnunet_plugin_transport_template |
46 | 47 | ||
@@ -213,6 +214,10 @@ shutdown_clean () | |||
213 | { | 214 | { |
214 | curl_multi_cleanup(multi_handle); | 215 | curl_multi_cleanup(multi_handle); |
215 | 216 | ||
217 | if (NULL != curl_handle) | ||
218 | curl_easy_cleanup (curl_handle); | ||
219 | |||
220 | |||
216 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) | 221 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) |
217 | { | 222 | { |
218 | GNUNET_SCHEDULER_cancel(sched,ti_send); | 223 | GNUNET_SCHEDULER_cancel(sched,ti_send); |
@@ -235,10 +240,8 @@ shutdown_clean () | |||
235 | 240 | ||
236 | GNUNET_SCHEDULER_shutdown(sched); | 241 | GNUNET_SCHEDULER_shutdown(sched); |
237 | 242 | ||
238 | 243 | GNUNET_free(msg->buf); | |
239 | 244 | GNUNET_free(msg); | |
240 | //GNUNET_free(msg); | ||
241 | //GNUNET_free(msg->buf); | ||
242 | 245 | ||
243 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting testcase\n"); | 246 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting testcase\n"); |
244 | exit(fail); | 247 | exit(fail); |
@@ -339,6 +342,8 @@ static size_t send_prepare( void ); | |||
339 | static void send_execute (void *cls, | 342 | static void send_execute (void *cls, |
340 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 343 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
341 | { | 344 | { |
345 | |||
346 | |||
342 | int running; | 347 | int running; |
343 | struct CURLMsg *msg; | 348 | struct CURLMsg *msg; |
344 | CURLMcode mret; | 349 | CURLMcode mret; |
@@ -378,21 +383,16 @@ static void send_execute (void *cls, | |||
378 | __LINE__, | 383 | __LINE__, |
379 | curl_easy_strerror (msg->data.result)); | 384 | curl_easy_strerror (msg->data.result)); |
380 | /* sending msg failed*/ | 385 | /* sending msg failed*/ |
381 | //if ( NULL != cs->transmit_cont) | ||
382 | // cs->transmit_cont (NULL,&cs->sender,GNUNET_SYSERR); | ||
383 | } | 386 | } |
384 | else | 387 | else |
385 | { | 388 | { |
386 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 389 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
387 | "Send completed.\n"); | 390 | "Send completed.\n"); |
388 | //if (GNUNET_OK != remove_http_message(cs, cs->pending_outbound_msg)) | 391 | /* sending completed */ |
389 | //GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Message could not be removed from session `%s'", GNUNET_i2s(&cs->sender)); | ||
390 | |||
391 | curl_easy_cleanup(curl_handle); | ||
392 | curl_handle=NULL; | ||
393 | shutdown_clean(); | ||
394 | |||
395 | } | 392 | } |
393 | curl_easy_cleanup(curl_handle); | ||
394 | curl_handle=NULL; | ||
395 | shutdown_clean(); | ||
396 | return; | 396 | return; |
397 | default: | 397 | default: |
398 | break; | 398 | break; |
@@ -469,14 +469,16 @@ static size_t send_prepare( void ) | |||
469 | */ | 469 | */ |
470 | static int send_data(struct HTTP_Message *msg, char * url) | 470 | static int send_data(struct HTTP_Message *msg, char * url) |
471 | { | 471 | { |
472 | //return GNUNET_OK; | 472 | |
473 | curl_handle = curl_easy_init(); | 473 | curl_handle = curl_easy_init(); |
474 | if( NULL == curl_handle) | 474 | if( NULL == curl_handle) |
475 | { | 475 | { |
476 | printf("easy_init failed \n"); | 476 | printf("easy_init failed \n"); |
477 | return GNUNET_SYSERR; | 477 | return GNUNET_SYSERR; |
478 | } | 478 | } |
479 | #if DEBUG_CURL | ||
479 | curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); | 480 | curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L); |
481 | #endif | ||
480 | curl_easy_setopt(curl_handle, CURLOPT_URL, url); | 482 | curl_easy_setopt(curl_handle, CURLOPT_URL, url); |
481 | curl_easy_setopt(curl_handle, CURLOPT_PUT, 1L); | 483 | curl_easy_setopt(curl_handle, CURLOPT_PUT, 1L); |
482 | curl_easy_setopt (curl_handle, CURLOPT_WRITEFUNCTION, ©Buffer); | 484 | curl_easy_setopt (curl_handle, CURLOPT_WRITEFUNCTION, ©Buffer); |