diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-01 16:42:02 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-06-01 16:42:02 +0000 |
commit | 08c56e7eb94ea53771190f987d25cbd48bac5e17 (patch) | |
tree | 0329377f78ead547854394f6c654452de3a82cb7 /src | |
parent | 520740d4575a810a4ace1134c778fd797296d817 (diff) | |
download | gnunet-08c56e7eb94ea53771190f987d25cbd48bac5e17.tar.gz gnunet-08c56e7eb94ea53771190f987d25cbd48bac5e17.zip |
-basic mhd working
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index b37421c82..cbc12ed02 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -187,6 +187,9 @@ run_httpd () | |||
187 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 187 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |
188 | GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); | 188 | GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); |
189 | GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); | 189 | GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); |
190 | |||
191 | if (httpd_task != GNUNET_SCHEDULER_NO_TASK) | ||
192 | GNUNET_SCHEDULER_cancel (httpd_task); | ||
190 | httpd_task = | 193 | httpd_task = |
191 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, | 194 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, |
192 | tv, wrs, wws, | 195 | tv, wrs, wws, |
@@ -493,32 +496,39 @@ do_read (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
493 | "Requested connection is gnunet tld\n", | 496 | "Requested connection is gnunet tld\n", |
494 | domain); | 497 | domain); |
495 | 498 | ||
496 | if (httpd == NULL) | 499 | if (NULL == httpd) |
497 | { | 500 | { |
498 | 501 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | |
499 | 502 | _("Failed to start HTTP server\n")); | |
500 | if (NULL == httpd) | 503 | s_resp->version = 0x05; |
501 | { | 504 | s_resp->reply = 0x01; |
502 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 505 | s5r->wtask = |
503 | _("Failed to start HTTP server\n")); | 506 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
504 | s_resp->version = 0x05; | 507 | s5r->sock, |
505 | s_resp->reply = 0x01; | 508 | &do_write, s5r); |
506 | s5r->wtask = | 509 | //ERROR! |
507 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 510 | //TODO! close socket after the write! schedule task |
508 | s5r->sock, | 511 | //GNUNET_NETWORK_socket_close (s5r->sock); |
509 | &do_write, s5r); | 512 | //GNUNET_free(s5r); |
510 | //ERROR! | ||
511 | //TODO! close socket after the write! schedule task | ||
512 | //GNUNET_NETWORK_socket_close (s5r->sock); | ||
513 | //GNUNET_free(s5r); | ||
514 | return; | ||
515 | } | ||
516 | |||
517 | add_handle_to_mhd ( s5r->sock ); | ||
518 | //GNUNET_free ( s5r ); | ||
519 | //FIXME complete socks resp! | ||
520 | return; | 513 | return; |
521 | } | 514 | } |
515 | |||
516 | if (MHD_YES == add_handle_to_mhd ( s5r->sock )) | ||
517 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
518 | "Sucessfully added client to MHD!\n"); | ||
519 | s_resp->version = 0x05; | ||
520 | s_resp->reply = 0x00; | ||
521 | s_resp->reserved = 0x00; | ||
522 | s_resp->addr_type = 0x01; | ||
523 | |||
524 | s5r->wtask = | ||
525 | GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | ||
526 | s5r->sock, | ||
527 | &do_write, s5r); | ||
528 | run_httpd (); | ||
529 | //GNUNET_free ( s5r ); | ||
530 | //FIXME complete socks resp! | ||
531 | return; | ||
522 | } | 532 | } |
523 | else | 533 | else |
524 | { | 534 | { |