[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11860 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11860 - gnunet/src/transport |
Date: |
Tue, 22 Jun 2010 09:55:07 +0200 |
Author: wachs
Date: 2010-06-22 09:55:07 +0200 (Tue, 22 Jun 2010)
New Revision: 11860
Modified:
gnunet/src/transport/plugin_transport_http.c
Log:
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2010-06-22 07:35:09 UTC
(rev 11859)
+++ gnunet/src/transport/plugin_transport_http.c 2010-06-22 07:55:07 UTC
(rev 11860)
@@ -186,6 +186,12 @@
struct sockaddr_in * addr_inbound;
/**
+ * Sender's ip address to distinguish between incoming connections
+ */
+ char * addr_inbound_str;
+
+
+ /**
* Sender's ip address recieved by transport
*/
struct sockaddr_in * addr_outbound;
@@ -380,6 +386,7 @@
memcpy(&ses->sender, peer, sizeof (struct GNUNET_PeerIdentity));
GNUNET_CRYPTO_hash_to_enc(&ses->sender.hashPubKey,&(ses->hash));
ses->is_active = GNUNET_NO;
+ ses->addr_inbound_str = NULL;
ses->pending_inbound_msg = GNUNET_malloc( sizeof (struct HTTP_Message));
ses->pending_inbound_msg->buf =
GNUNET_malloc(GNUNET_SERVER_MAX_MESSAGE_SIZE);
ses->pending_inbound_msg->len = GNUNET_SERVER_MAX_MESSAGE_SIZE;
@@ -413,7 +420,11 @@
GNUNET_MessageHeader *
message)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"messageTokenizerCallback\n");
+ struct Session * cs;
+ GNUNET_assert(cls != NULL);
+ cs = (struct Session *) cls;
+
+ plugin->env->receive(plugin->env->cls, &(cs->sender), message, 1, NULL ,
cs->addr_inbound_str, strlen(cs->addr_inbound_str));
}
/**
@@ -545,10 +556,22 @@
*httpSessionCache = cs;
/* Updating session */
memcpy(cs->addr_inbound,conn_info->client_addr, sizeof(struct
sockaddr_in));
+ if (cs->addr_inbound_str != NULL)
+ GNUNET_free (cs->addr_inbound_str);
+ if ( AF_INET == cs->addr_inbound->sin_family)
+ {
+
GNUNET_asprintf(&cs->addr_inbound_str,"%s:%u",address,ntohs(cs->addr_inbound->sin_port));
+ }
+
+ if ( AF_INET6 == cs->addr_inbound->sin_family)
+ {
+
GNUNET_asprintf(&cs->addr_inbound_str,"[%s]:%u",address,ntohs(cs->addr_inbound->sin_port));
+
+ }
if (cs->msgtok==NULL)
- cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
cs, &messageTokenizerCallback, NULL);
+ cs->msgtok = GNUNET_SERVER_mst_create (GNUNET_SERVER_MAX_MESSAGE_SIZE,
cs, &messageTokenizerCallback, cs);
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s'
request from peer `%s' (`[%s]:%u')\n",method,
GNUNET_i2s(&cs->sender),address,ntohs(cs->addr_inbound->sin_port));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"HTTP Daemon has new an incoming `%s'
request from peer `%s' (`%s')\n",method,
GNUNET_i2s(&cs->sender),cs->addr_inbound_str);
}
else
{
@@ -627,7 +650,6 @@
#if 0
if (len == cs->pending_inbound_msg->pos)
{
- char * tmp = NULL;
if ( AF_INET == cs->addr_inbound->sin_family)
{
inet_ntop(AF_INET,
&(cs->addr_inbound)->sin_addr,address,INET_ADDRSTRLEN);
@@ -1665,6 +1687,7 @@
GNUNET_free (cs->pending_inbound_msg->buf);
GNUNET_free (cs->pending_inbound_msg);
GNUNET_free_non_null (cs->addr_inbound);
+ GNUNET_free_non_null (cs->addr_inbound_str);
GNUNET_free_non_null (cs->addr_outbound);
GNUNET_free (cs);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11860 - gnunet/src/transport,
gnunet <=