projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e8a7665
)
fix type issue
author
Matthias Wachs
<wachs@net.in.tum.de>
Thu, 4 Oct 2012 12:47:33 +0000
(12:47 +0000)
committer
Matthias Wachs
<wachs@net.in.tum.de>
Thu, 4 Oct 2012 12:47:33 +0000
(12:47 +0000)
src/transport/gnunet-service-transport_clients.c
patch
|
blob
|
history
src/transport/gnunet-service-transport_clients.h
patch
|
blob
|
history
src/transport/gnunet-service-transport_neighbours.c
patch
|
blob
|
history
src/transport/plugin_transport_http_server.c
patch
|
blob
|
history
diff --git
a/src/transport/gnunet-service-transport_clients.c
b/src/transport/gnunet-service-transport_clients.c
index 294af9ba91cd1282ce38d3f9a24a6892f137a621..848351f12ad2af5c2edbe48f7398f2cb1913ac4c 100644
(file)
--- a/
src/transport/gnunet-service-transport_clients.c
+++ b/
src/transport/gnunet-service-transport_clients.c
@@
-974,6
+974,18
@@
GST_clients_stop ()
}
}
}
}
+/**
+ * Tell clients how many bytes were used on the wire
+ * Can differ from payload bytes depending on plugin
+ *
+ * @param n peer
+ * @param send_phys bytes sent on the wire
+ */
+void
+GST_clients_communicate_bytes_used (const struct GNUNET_PeerIdentity *n, ssize_t send_phys)
+{
+ //FIXME: To be implemented
+}
/**
* Broadcast the given message to all of our clients.
/**
* Broadcast the given message to all of our clients.
diff --git
a/src/transport/gnunet-service-transport_clients.h
b/src/transport/gnunet-service-transport_clients.h
index 9556620dd5021405a7939d9072b376585ceb0f41..757780f9113bcf01b384d66d56082d52322dd04c 100644
(file)
--- a/
src/transport/gnunet-service-transport_clients.h
+++ b/
src/transport/gnunet-service-transport_clients.h
@@
-39,6
+39,16
@@
void
GST_clients_start (struct GNUNET_SERVER_Handle *server);
void
GST_clients_start (struct GNUNET_SERVER_Handle *server);
+/**
+ * Tell clients how many bytes were used on the wire
+ * Can differ from payload bytes depending on plugin
+ *
+ * @param n peer
+ * @param send_phys bytes sent on the wire
+ */
+void
+GST_clients_communicate_bytes_used (const struct GNUNET_PeerIdentity *n, ssize_t send_phys);
+
/**
* Stop processing clients.
/**
* Stop processing clients.
diff --git
a/src/transport/gnunet-service-transport_neighbours.c
b/src/transport/gnunet-service-transport_neighbours.c
index d10a74e36d3494cf12ff1f1922e51f88d5ab4cae..592dcd849d623b09b73356146795ac92af173e34 100644
(file)
--- a/
src/transport/gnunet-service-transport_neighbours.c
+++ b/
src/transport/gnunet-service-transport_neighbours.c
@@
-924,7
+924,6
@@
free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
GNUNET_free (n);
}
GNUNET_free (n);
}
-
/**
* Transmit a message using the current session of the given
* neighbour.
/**
* Transmit a message using the current session of the given
* neighbour.
@@
-946,17
+945,20
@@
send_with_session (struct NeighbourMapEntry *n,
void *cont_cls)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
void *cont_cls)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
+ ssize_t send_phys;
GNUNET_assert (n->primary_address.session != NULL);
if ( ( (NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name))) ||
GNUNET_assert (n->primary_address.session != NULL);
if ( ( (NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name))) ||
- (-1 == papi->send (papi->cls,
+ (-1 ==
(send_phys =
papi->send (papi->cls,
n->primary_address.session,
msgbuf, msgbuf_size,
priority,
timeout,
n->primary_address.session,
msgbuf, msgbuf_size,
priority,
timeout,
- cont, cont_cls))) &&
+ cont, cont_cls)))
)
&&
(NULL != cont) )
cont (cont_cls, &n->id, GNUNET_SYSERR);
(NULL != cont) )
cont (cont_cls, &n->id, GNUNET_SYSERR);
+ if (-1 != send_phys)
+ GST_clients_communicate_bytes_used (&n->id, send_phys);
GNUNET_break (NULL != papi);
}
GNUNET_break (NULL != papi);
}
@@
-1520,6
+1522,7
@@
send_session_connect (struct NeighbourAddress *na)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
+ ssize_t send_phys;
if (NULL == (papi = GST_plugins_find (na->address->transport_name)))
{
if (NULL == (papi = GST_plugins_find (na->address->transport_name)))
{
@@
-1538,12
+1541,14
@@
send_session_connect (struct NeighbourAddress *na)
connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
connect_msg.reserved = htonl (0);
connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp);
connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
connect_msg.reserved = htonl (0);
connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp);
-
(void)
papi->send (papi->cls,
+
send_phys =
papi->send (papi->cls,
na->session,
(const char *) &connect_msg, sizeof (struct SessionConnectMessage),
UINT_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
na->session,
(const char *) &connect_msg, sizeof (struct SessionConnectMessage),
UINT_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
+ if (-1 != send_phys)
+ GST_clients_communicate_bytes_used (&na->address->peer, send_phys);
}
}
@@
-1561,6
+1566,7
@@
send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address,
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
+ ssize_t send_phys;
if (NULL == (papi = GST_plugins_find (address->transport_name)))
{
if (NULL == (papi = GST_plugins_find (address->transport_name)))
{
@@
-1578,12
+1584,14
@@
send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address,
connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK);
connect_msg.reserved = htonl (0);
connect_msg.timestamp = GNUNET_TIME_absolute_hton (timestamp);
connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK);
connect_msg.reserved = htonl (0);
connect_msg.timestamp = GNUNET_TIME_absolute_hton (timestamp);
-
(void)
papi->send (papi->cls,
+
send_phys =
papi->send (papi->cls,
session,
(const char *) &connect_msg, sizeof (struct SessionConnectMessage),
UINT_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
session,
(const char *) &connect_msg, sizeof (struct SessionConnectMessage),
UINT_MAX,
GNUNET_TIME_UNIT_FOREVER_REL,
NULL, NULL);
+ if (-1 != send_phys)
+ GST_clients_communicate_bytes_used (&address->peer, send_phys);
}
}
diff --git
a/src/transport/plugin_transport_http_server.c
b/src/transport/plugin_transport_http_server.c
index 7426dee10e2c737c696dbfa5aceddcfe857f1bb0..ea4a0917556aaf3d6058843c382ef0cf5299db68 100644
(file)
--- a/
src/transport/plugin_transport_http_server.c
+++ b/
src/transport/plugin_transport_http_server.c
@@
-876,6
+876,7
@@
server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN
char * separator = NULL;
char hash[plugin->peer_id_length+1];
int hash_length;
char * separator = NULL;
char hash[plugin->peer_id_length+1];
int hash_length;
+ unsigned long int ctag;
/* URL parsing
* URL is valid if it is in the form [prefix with (multiple) '/'][peerid[103];tag]*/
/* URL parsing
* URL is valid if it is in the form [prefix with (multiple) '/'][peerid[103];tag]*/
@@
-903,19
+904,26
@@
server_parse_url (struct HTTP_Server_Plugin *plugin, const char * url, struct GN
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
-
(*tag)
= strtoul (tag_start, &tag_end, 10);
- if (
(*tag)
== 0)
+
ctag
= strtoul (tag_start, &tag_end, 10);
+ if (
ctag
== 0)
{
/* tag == 0 , invalid */
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
{
/* tag == 0 , invalid */
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
- if ((
(*tag)
== ULONG_MAX) && (ERANGE == errno))
+ if ((
ctag
== ULONG_MAX) && (ERANGE == errno))
{
/* out of range: > ULONG_MAX */
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
{
/* out of range: > ULONG_MAX */
if (debug) GNUNET_break (0);
return GNUNET_SYSERR;
}
+ if (ctag > UINT32_MAX)
+ {
+ /* out of range: > UINT32_MAX */
+ if (debug) GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ (*tag) = (uint32_t) ctag;
if (NULL == tag_end)
{
/* no char after tag */
if (NULL == tag_end)
{
/* no char after tag */