[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13852 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13852 - gnunet/src/transport |
Date: |
Tue, 30 Nov 2010 18:44:37 +0100 |
Author: wachs
Date: 2010-11-30 18:44:36 +0100 (Tue, 30 Nov 2010)
New Revision: 13852
Modified:
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/transport_api.c
Log:
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2010-11-30 17:06:01 UTC
(rev 13851)
+++ gnunet/src/transport/gnunet-service-transport.c 2010-11-30 17:44:36 UTC
(rev 13852)
@@ -2224,6 +2224,10 @@
cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
cim.distance = htonl (distance);
cim.latency = GNUNET_TIME_relative_hton (latency);
+ cim.ats_count = htonl(0);
+ cim.ats.type = htonl(0);
+ cim.ats.value = htonl(0);
+ fprintf (stderr,"%lu %u %lu ", sizeof (struct ConnectInfoMessage),
ntohl(cim.ats_count), sizeof (struct GNUNET_TRANSPORT_ATS_Information));
memcpy (&cim.id, peer, sizeof (struct GNUNET_PeerIdentity));
cpos = clients;
while (cpos != NULL)
@@ -3445,11 +3449,10 @@
GNUNET_NO);
/* transmit message to all clients */
+ fprintf(stderr,"handle_payload_message ats_count %u\n",ats_count);
im = GNUNET_malloc (sizeof (struct InboundMessage) + ats_count *
sizeof(struct GNUNET_TRANSPORT_ATS_Information) + msize);
im->header.size = htons (sizeof (struct InboundMessage) + ats_count *
sizeof(struct GNUNET_TRANSPORT_ATS_Information) + msize);
im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
- //im->latency = GNUNET_TIME_relative_hton (n->latency);
- //im->distance = ntohl(n->distance);
im->peer = n->id;
im->ats_count = htonl(ats_count);
/* insert ATS elements */
@@ -3680,14 +3683,17 @@
if (NULL != (prem = n->pre_connect_message_buffer))
{
n->pre_connect_message_buffer = NULL;
- /*
struct GNUNET_TRANSPORT_ATS_Information * ats = GNUNET_malloc(2 *
sizeof(struct GNUNET_TRANSPORT_ATS_Information));
- ats[0].type = htonl(GNUNET_TRANSPORT_LATENCY_LSB);
- ats[0].value = htonl(n->latency.rel_value);
- ats[1].type = htonl(GNUNET_TRANSPORT_DISTANCE);
- ats[1].value = htonl(n->distance);*/
- handle_payload_message (prem, n, NULL, 0);
- //GNUNET_free (ats);
+ ats[0].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ if (n->latency.rel_value <= UINT32_MAX)
+ ats[0].value = htonl((uint32_t) n->latency.rel_value);
+ else
+ ats[0].value = htonl(UINT32_MAX);
+ ats[1].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ ats[1].value = htonl(n->distance);
+ //handle_payload_message (prem, n, NULL, 0);
+ handle_payload_message (prem, n, ats, 2);
+ GNUNET_free (ats);
GNUNET_free (prem);
}
}
@@ -4692,6 +4698,7 @@
struct ForeignAddressList *peer_address;
uint16_t msize;
struct NeighbourList *n;
+ struct GNUNET_TRANSPORT_ATS_Information * ats;
struct GNUNET_TIME_Relative ret;
if (is_blacklisted (peer, plugin))
return GNUNET_TIME_UNIT_FOREVER_REL;
@@ -4777,8 +4784,17 @@
handle_pong (plugin, message, peer, sender_address,
sender_address_len);
break;
default:
- /* FIXME */
- handle_payload_message (message, n, NULL, 0);
+ ats = GNUNET_malloc(2 * sizeof(struct
GNUNET_TRANSPORT_ATS_Information));
+ ats[0].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+ if (n->latency.rel_value <= UINT32_MAX)
+ ats[0].value = htonl((uint32_t) n->latency.rel_value);
+ else
+ ats[0].value = htonl(UINT32_MAX);
+ ats[1].type = htonl(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+ ats[1].value = htonl(n->distance);
+ //handle_payload_message (message, n, NULL, 0);
+ handle_payload_message (message, n, ats, 2);
+ GNUNET_free(ats);
break;
}
}
@@ -4860,6 +4876,9 @@
/* tell new client about all existing connections */
cim.header.size = htons (sizeof (struct ConnectInfoMessage));
cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
+ cim.ats_count = htonl(0);
+ cim.ats.type = htonl(0);
+ cim.ats.value = htonl(0);
n = neighbours;
while (n != NULL)
{
@@ -4868,6 +4887,7 @@
cim.id = n->id;
cim.latency = GNUNET_TIME_relative_hton (n->latency);
cim.distance = htonl (n->distance);
+ fprintf (stderr,"%lu %u %lu ", sizeof (struct
ConnectInfoMessage), ntohl(cim.ats_count), sizeof (struct
GNUNET_TRANSPORT_ATS_Information));
transmit_to_client (c, &cim.header, GNUNET_NO);
}
n = n->next;
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2010-11-30 17:06:01 UTC (rev
13851)
+++ gnunet/src/transport/transport_api.c 2010-11-30 17:44:36 UTC (rev
13852)
@@ -1681,13 +1681,12 @@
return;
}
fprintf(stderr,"transport_api GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT
ats_count %u\n",ntohl (cim->ats_count));
- n->is_connected = GNUNET_YES;
+ n->is_connected = GNUNET_YES;
if (h->nc_cb != NULL)
h->nc_cb (h->cls, &n->id,
NULL,
0);
-
- /* FIX if (h->nc_cb != NULL)
+ /* if (h->nc_cb != NULL)
h->nc_cb (h->cls, &n->id,
&(cim->ats),
ntohl (cim->ats_count));*/
@@ -1787,13 +1786,13 @@
return;
}
fprintf(stderr,"transport_api GNUNET_MESSAGE_TYPE_TRANSPORT_RECV
ats_count %u\n",ntohl (im->ats_count));
- if (h->rec != NULL)
+ if (h->rec != NULL)
h->rec (h->cls, &im->peer,
imm,
NULL,
0);
- /* FIX
- h->rec (h->cls, &im->peer,
+
+ /*h->rec (h->cls, &im->peer,
imm,
&im->ats,
ntohl (im->ats_count));*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13852 - gnunet/src/transport,
gnunet <=