aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-07-02 15:28:20 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-07-02 15:28:20 +0000
commit2cb2eb3273b07eaa5b2af361561d2af682de6ee6 (patch)
tree26d2b933714b336ca8cd12cd89aeabcce13f65bd /src/transport/plugin_transport_http.c
parent6808383ffb5f49aedd72d4e1ff0cfb377bf86bdc (diff)
downloadgnunet-2cb2eb3273b07eaa5b2af361561d2af682de6ee6.tar.gz
gnunet-2cb2eb3273b07eaa5b2af361561d2af682de6ee6.zip
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r--src/transport/plugin_transport_http.c54
1 files changed, 12 insertions, 42 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 5a9bde0bc..da59f848b 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -28,7 +28,6 @@
28#include "gnunet_constants.h" 28#include "gnunet_constants.h"
29#include "gnunet_protocols.h" 29#include "gnunet_protocols.h"
30#include "gnunet_connection_lib.h" 30#include "gnunet_connection_lib.h"
31#include "gnunet_server_lib.h"
32#include "gnunet_service_lib.h" 31#include "gnunet_service_lib.h"
33#include "gnunet_statistics_service.h" 32#include "gnunet_statistics_service.h"
34#include "gnunet_transport_service.h" 33#include "gnunet_transport_service.h"
@@ -238,17 +237,6 @@ struct Session
238 struct GNUNET_PeerIdentity identity; 237 struct GNUNET_PeerIdentity identity;
239 238
240 /** 239 /**
241 * Sender's ip address to distinguish between incoming connections
242 */
243 void * addr_in;
244
245 size_t addr_in_len;
246
247 void * addr_out;
248
249 size_t addr_out_len;
250
251 /**
252 * Did we initiate the connection (GNUNET_YES) or the other peer (GNUNET_NO)? 240 * Did we initiate the connection (GNUNET_YES) or the other peer (GNUNET_NO)?
253 */ 241 */
254 int is_client; 242 int is_client;
@@ -275,16 +263,6 @@ struct Session
275 */ 263 */
276 struct GNUNET_CRYPTO_HashAsciiEncoded hash; 264 struct GNUNET_CRYPTO_HashAsciiEncoded hash;
277 265
278 /**
279 * curl handle for outbound transmissions
280 */
281 CURL *curl_handle;
282
283 /**
284 * Message tokenizer for incoming data
285 */
286 //struct GNUNET_SERVER_MessageStreamTokenizer * msgtok;
287
288 struct HTTP_Connection *outbound_connections_head; 266 struct HTTP_Connection *outbound_connections_head;
289 struct HTTP_Connection *outbound_connections_tail; 267 struct HTTP_Connection *outbound_connections_tail;
290 268
@@ -385,19 +363,6 @@ create_session (void * cls,
385 struct Session * cs = GNUNET_malloc ( sizeof( struct Session) ); 363 struct Session * cs = GNUNET_malloc ( sizeof( struct Session) );
386 364
387 GNUNET_assert(cls !=NULL); 365 GNUNET_assert(cls !=NULL);
388 if (addrlen_in != 0)
389 {
390 cs->addr_in = GNUNET_malloc (addrlen_in);
391 cs->addr_in_len = addrlen_in;
392 memcpy(cs->addr_in,addr_in,addrlen_in);
393 }
394
395 if (addrlen_out != 0)
396 {
397 cs->addr_out = GNUNET_malloc (addrlen_out);
398 cs->addr_out_len = addrlen_out;
399 memcpy(cs->addr_out,addr_out,addrlen_out);
400 }
401 cs->plugin = plugin; 366 cs->plugin = plugin;
402 memcpy(&cs->identity, peer, sizeof (struct GNUNET_PeerIdentity)); 367 memcpy(&cs->identity, peer, sizeof (struct GNUNET_PeerIdentity));
403 GNUNET_CRYPTO_hash_to_enc(&cs->identity.hashPubKey,&(cs->hash)); 368 GNUNET_CRYPTO_hash_to_enc(&cs->identity.hashPubKey,&(cs->hash));
@@ -615,13 +580,15 @@ int server_read_callback (void *cls, uint64_t pos, char *buf, int max)
615 580
616 struct HTTP_Connection * con = cls; 581 struct HTTP_Connection * con = cls;
617 struct HTTP_Message * msg; 582 struct HTTP_Message * msg;
618 int res; 583 int res;res=5;
584
585 msg=con->pending_msgs_tail;
586
619 587
620 if (con->pending_msgs_tail!=NULL) 588 if (msg!=NULL)
621 { 589 {
622 msg=con->pending_msgs_tail; 590 /*
623 /* 591 if ((msg->size-msg->pos) <= max)
624 if ((msg->size-msg->pos) <= max)
625 { 592 {
626 memcpy(buf,&msg->buf[pos],(msg->size-msg->pos)); 593 memcpy(buf,&msg->buf[pos],(msg->size-msg->pos));
627 pos+=(msg->size-msg->pos); 594 pos+=(msg->size-msg->pos);
@@ -630,14 +597,17 @@ int server_read_callback (void *cls, uint64_t pos, char *buf, int max)
630 { 597 {
631 memcpy(buf,&msg->buf[pos],max); 598 memcpy(buf,&msg->buf[pos],max);
632 pos+=max; 599 pos+=max;
633 }*/ 600 }
601
634 if (msg->pos==msg->size) 602 if (msg->pos==msg->size)
635 { 603 {
636 if (NULL != con->pending_msgs_tail->transmit_cont) 604 if (NULL != con->pending_msgs_tail->transmit_cont)
637 msg->transmit_cont (msg->transmit_cont_cls,&con->session->identity,GNUNET_SYSERR); 605 msg->transmit_cont (msg->transmit_cont_cls,&con->session->identity,GNUNET_SYSERR);
638 res = remove_http_message(con,msg); 606 res = remove_http_message(con,msg);
639 } 607 }
608 */
640 } 609 }
610
641 return bytes_read; 611 return bytes_read;
642} 612}
643 613
@@ -723,7 +693,7 @@ accessHandlerCallback (void *cls,
723 693
724 *httpSessionCache = con; 694 *httpSessionCache = con;
725 if (con->msgtok==NULL) 695 if (con->msgtok==NULL)
726 con->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1, &messageTokenizerCallback, con); 696 con->msgtok = GNUNET_SERVER_mst_create (&messageTokenizerCallback, con);
727 697
728 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s' request from peer `%s' (`%s')\n", 698 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s' request from peer `%s' (`%s')\n",
729 method, 699 method,