diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-04 12:47:33 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-04 12:47:33 +0000 |
commit | 32819ab9c5f4366788088ff39792f4c7066c0f31 (patch) | |
tree | a54051a4f9b488a462be9f49ba03ef7a18c9a6ab /src/transport | |
parent | e8a76652365d6c1bd6bd4903b2b4ba72447c961b (diff) | |
download | gnunet-32819ab9c5f4366788088ff39792f4c7066c0f31.tar.gz gnunet-32819ab9c5f4366788088ff39792f4c7066c0f31.zip |
fix type issue
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 12 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_clients.h | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 18 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 14 |
4 files changed, 46 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 294af9ba9..848351f12 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -974,6 +974,18 @@ GST_clients_stop () | |||
974 | } | 974 | } |
975 | } | 975 | } |
976 | 976 | ||
977 | /** | ||
978 | * Tell clients how many bytes were used on the wire | ||
979 | * Can differ from payload bytes depending on plugin | ||
980 | * | ||
981 | * @param n peer | ||
982 | * @param send_phys bytes sent on the wire | ||
983 | */ | ||
984 | void | ||
985 | GST_clients_communicate_bytes_used (const struct GNUNET_PeerIdentity *n, ssize_t send_phys) | ||
986 | { | ||
987 | //FIXME: To be implemented | ||
988 | } | ||
977 | 989 | ||
978 | /** | 990 | /** |
979 | * Broadcast the given message to all of our clients. | 991 | * 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 9556620dd..757780f91 100644 --- a/src/transport/gnunet-service-transport_clients.h +++ b/src/transport/gnunet-service-transport_clients.h | |||
@@ -39,6 +39,16 @@ | |||
39 | void | 39 | void |
40 | GST_clients_start (struct GNUNET_SERVER_Handle *server); | 40 | GST_clients_start (struct GNUNET_SERVER_Handle *server); |
41 | 41 | ||
42 | /** | ||
43 | * Tell clients how many bytes were used on the wire | ||
44 | * Can differ from payload bytes depending on plugin | ||
45 | * | ||
46 | * @param n peer | ||
47 | * @param send_phys bytes sent on the wire | ||
48 | */ | ||
49 | void | ||
50 | GST_clients_communicate_bytes_used (const struct GNUNET_PeerIdentity *n, ssize_t send_phys); | ||
51 | |||
42 | 52 | ||
43 | /** | 53 | /** |
44 | * Stop processing clients. | 54 | * Stop processing clients. |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index d10a74e36..592dcd849 100644 --- 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) | |||
924 | GNUNET_free (n); | 924 | GNUNET_free (n); |
925 | } | 925 | } |
926 | 926 | ||
927 | |||
928 | /** | 927 | /** |
929 | * Transmit a message using the current session of the given | 928 | * Transmit a message using the current session of the given |
930 | * neighbour. | 929 | * neighbour. |
@@ -946,17 +945,20 @@ send_with_session (struct NeighbourMapEntry *n, | |||
946 | void *cont_cls) | 945 | void *cont_cls) |
947 | { | 946 | { |
948 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 947 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
948 | ssize_t send_phys; | ||
949 | 949 | ||
950 | GNUNET_assert (n->primary_address.session != NULL); | 950 | GNUNET_assert (n->primary_address.session != NULL); |
951 | if ( ( (NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name))) || | 951 | if ( ( (NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name))) || |
952 | (-1 == papi->send (papi->cls, | 952 | (-1 == (send_phys = papi->send (papi->cls, |
953 | n->primary_address.session, | 953 | n->primary_address.session, |
954 | msgbuf, msgbuf_size, | 954 | msgbuf, msgbuf_size, |
955 | priority, | 955 | priority, |
956 | timeout, | 956 | timeout, |
957 | cont, cont_cls))) && | 957 | cont, cont_cls)))) && |
958 | (NULL != cont) ) | 958 | (NULL != cont) ) |
959 | cont (cont_cls, &n->id, GNUNET_SYSERR); | 959 | cont (cont_cls, &n->id, GNUNET_SYSERR); |
960 | if (-1 != send_phys) | ||
961 | GST_clients_communicate_bytes_used (&n->id, send_phys); | ||
960 | GNUNET_break (NULL != papi); | 962 | GNUNET_break (NULL != papi); |
961 | } | 963 | } |
962 | 964 | ||
@@ -1520,6 +1522,7 @@ send_session_connect (struct NeighbourAddress *na) | |||
1520 | { | 1522 | { |
1521 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 1523 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
1522 | struct SessionConnectMessage connect_msg; | 1524 | struct SessionConnectMessage connect_msg; |
1525 | ssize_t send_phys; | ||
1523 | 1526 | ||
1524 | if (NULL == (papi = GST_plugins_find (na->address->transport_name))) | 1527 | if (NULL == (papi = GST_plugins_find (na->address->transport_name))) |
1525 | { | 1528 | { |
@@ -1538,12 +1541,14 @@ send_session_connect (struct NeighbourAddress *na) | |||
1538 | connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); | 1541 | connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); |
1539 | connect_msg.reserved = htonl (0); | 1542 | connect_msg.reserved = htonl (0); |
1540 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp); | 1543 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp); |
1541 | (void) papi->send (papi->cls, | 1544 | send_phys = papi->send (papi->cls, |
1542 | na->session, | 1545 | na->session, |
1543 | (const char *) &connect_msg, sizeof (struct SessionConnectMessage), | 1546 | (const char *) &connect_msg, sizeof (struct SessionConnectMessage), |
1544 | UINT_MAX, | 1547 | UINT_MAX, |
1545 | GNUNET_TIME_UNIT_FOREVER_REL, | 1548 | GNUNET_TIME_UNIT_FOREVER_REL, |
1546 | NULL, NULL); | 1549 | NULL, NULL); |
1550 | if (-1 != send_phys) | ||
1551 | GST_clients_communicate_bytes_used (&na->address->peer, send_phys); | ||
1547 | } | 1552 | } |
1548 | 1553 | ||
1549 | 1554 | ||
@@ -1561,6 +1566,7 @@ send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address, | |||
1561 | { | 1566 | { |
1562 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 1567 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
1563 | struct SessionConnectMessage connect_msg; | 1568 | struct SessionConnectMessage connect_msg; |
1569 | ssize_t send_phys; | ||
1564 | 1570 | ||
1565 | if (NULL == (papi = GST_plugins_find (address->transport_name))) | 1571 | if (NULL == (papi = GST_plugins_find (address->transport_name))) |
1566 | { | 1572 | { |
@@ -1578,12 +1584,14 @@ send_session_connect_ack_message (const struct GNUNET_HELLO_Address *address, | |||
1578 | connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK); | 1584 | connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK); |
1579 | connect_msg.reserved = htonl (0); | 1585 | connect_msg.reserved = htonl (0); |
1580 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (timestamp); | 1586 | connect_msg.timestamp = GNUNET_TIME_absolute_hton (timestamp); |
1581 | (void) papi->send (papi->cls, | 1587 | send_phys = papi->send (papi->cls, |
1582 | session, | 1588 | session, |
1583 | (const char *) &connect_msg, sizeof (struct SessionConnectMessage), | 1589 | (const char *) &connect_msg, sizeof (struct SessionConnectMessage), |
1584 | UINT_MAX, | 1590 | UINT_MAX, |
1585 | GNUNET_TIME_UNIT_FOREVER_REL, | 1591 | GNUNET_TIME_UNIT_FOREVER_REL, |
1586 | NULL, NULL); | 1592 | NULL, NULL); |
1593 | if (-1 != send_phys) | ||
1594 | GST_clients_communicate_bytes_used (&address->peer, send_phys); | ||
1587 | } | 1595 | } |
1588 | 1596 | ||
1589 | 1597 | ||
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 7426dee10..ea4a09175 100644 --- 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 | |||
876 | char * separator = NULL; | 876 | char * separator = NULL; |
877 | char hash[plugin->peer_id_length+1]; | 877 | char hash[plugin->peer_id_length+1]; |
878 | int hash_length; | 878 | int hash_length; |
879 | unsigned long int ctag; | ||
879 | 880 | ||
880 | /* URL parsing | 881 | /* URL parsing |
881 | * URL is valid if it is in the form [prefix with (multiple) '/'][peerid[103];tag]*/ | 882 | * 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 | |||
903 | if (debug) GNUNET_break (0); | 904 | if (debug) GNUNET_break (0); |
904 | return GNUNET_SYSERR; | 905 | return GNUNET_SYSERR; |
905 | } | 906 | } |
906 | (*tag) = strtoul (tag_start, &tag_end, 10); | 907 | ctag = strtoul (tag_start, &tag_end, 10); |
907 | if ((*tag) == 0) | 908 | if (ctag == 0) |
908 | { | 909 | { |
909 | /* tag == 0 , invalid */ | 910 | /* tag == 0 , invalid */ |
910 | if (debug) GNUNET_break (0); | 911 | if (debug) GNUNET_break (0); |
911 | return GNUNET_SYSERR; | 912 | return GNUNET_SYSERR; |
912 | } | 913 | } |
913 | if (((*tag) == ULONG_MAX) && (ERANGE == errno)) | 914 | if ((ctag == ULONG_MAX) && (ERANGE == errno)) |
914 | { | 915 | { |
915 | /* out of range: > ULONG_MAX */ | 916 | /* out of range: > ULONG_MAX */ |
916 | if (debug) GNUNET_break (0); | 917 | if (debug) GNUNET_break (0); |
917 | return GNUNET_SYSERR; | 918 | return GNUNET_SYSERR; |
918 | } | 919 | } |
920 | if (ctag > UINT32_MAX) | ||
921 | { | ||
922 | /* out of range: > UINT32_MAX */ | ||
923 | if (debug) GNUNET_break (0); | ||
924 | return GNUNET_SYSERR; | ||
925 | } | ||
926 | (*tag) = (uint32_t) ctag; | ||
919 | if (NULL == tag_end) | 927 | if (NULL == tag_end) |
920 | { | 928 | { |
921 | /* no char after tag */ | 929 | /* no char after tag */ |