#include "transport.h"
+
/**
* Size of the neighbour hash map.
*/
GNUNET_break (0);
return "UNDEFINED";
}
- GNUNET_break (0);
return "UNDEFINED";
}
{
GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
if (NULL != mq->cont)
- mq->cont (mq->cont_cls, GNUNET_SYSERR);
+ mq->cont (mq->cont_cls, GNUNET_SYSERR, mq->message_buf_size, 0);
GNUNET_free (mq);
}
/* It is too late to send other peer disconnect notifications, but at
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))) ||
- (-1 == (send_phys = papi->send (papi->cls,
+ if ( ((NULL == (papi = GST_plugins_find (n->primary_address.address->transport_name)) ||
+ (-1 == papi->send (papi->cls,
n->primary_address.session,
msgbuf, msgbuf_size,
priority,
timeout,
cont, cont_cls)))) &&
- (NULL != cont) )
- cont (cont_cls, &n->id, GNUNET_SYSERR);
- if (-1 != send_phys)
- GST_clients_communicate_bytes_used (&n->id, send_phys);
+ (NULL != cont))
+ cont (cont_cls, &n->id, GNUNET_SYSERR, msgbuf_size, 0);
GNUNET_break (NULL != papi);
}
* @param cls NULL
* @param target identity of the neighbour that was disconnected
* @param result GNUNET_OK if the disconnect got out successfully
+ * @param payload bytes payload
+ * @param physical bytes physical
*/
static void
send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target,
- int result)
+ int result, size_t payload, size_t physical)
{
struct NeighbourMapEntry *n;
* @param cls the 'struct MessageQueue' of the message
* @param receiver intended receiver
* @param success whether it worked or not
+ * @param size_payload bytes payload sent
+ * @param physical bytes sent on wire
*/
static void
transmit_send_continuation (void *cls,
const struct GNUNET_PeerIdentity *receiver,
- int success)
+ int success, size_t size_payload, size_t physical)
{
struct MessageQueue *mq = cls;
struct NeighbourMapEntry *n;
GNUNET_SCHEDULER_cancel (n->task);
n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
}
- GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size);
+ if (bytes_in_send_queue < mq->message_buf_size)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "bytes_in_send_queue `%u' mq->message_buf_size %u\n",
+ bytes_in_send_queue, mq->message_buf_size );
+ GNUNET_break (0);
+ }
+
+
+ GNUNET_break (size_payload == mq->message_buf_size);
bytes_in_send_queue -= mq->message_buf_size;
GNUNET_STATISTICS_set (GST_stats,
gettext_noop
ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type),
(success == GNUNET_OK) ? "success" : "FAILURE");
if (NULL != mq->cont)
- mq->cont (mq->cont_cls, success);
+ mq->cont (mq->cont_cls, success, size_payload, physical);
GNUNET_free (mq);
}
1, GNUNET_NO);
GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
n->is_active = mq;
- transmit_send_continuation (mq, &n->id, GNUNET_SYSERR); /* timeout */
+ transmit_send_continuation (mq, &n->id, GNUNET_SYSERR, mq->message_buf_size, 0); /* timeout */
}
if (NULL == mq)
return; /* no more messages */
{
GNUNET_break (0);
if (NULL != cont)
- cont (cont_cls, GNUNET_SYSERR);
+ cont (cont_cls, GNUNET_SYSERR, msg_size, 0);
return;
}
if (GNUNET_YES != test_connected (n))
{
GNUNET_break (0);
if (NULL != cont)
- cont (cont_cls, GNUNET_SYSERR);
+ cont (cont_cls, GNUNET_SYSERR, msg_size, 0);
return;
}
bytes_in_send_queue += msg_size;
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
- ssize_t send_phys;
-
+
if (NULL == (papi = GST_plugins_find (na->address->transport_name)))
{
GNUNET_break (0);
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);
- send_phys = papi->send (papi->cls,
+ (void) papi->send (papi->cls,
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);
+
}
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct SessionConnectMessage connect_msg;
- ssize_t send_phys;
-
+
if (NULL == (papi = GST_plugins_find (address->transport_name)))
{
GNUNET_break (0);
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);
- send_phys = papi->send (papi->cls,
+ (void) papi->send (papi->cls,
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);
+
}
connect_notify_cb = connect_cb;
disconnect_notify_cb = disconnect_cb;
address_change_cb = peer_address_cb;
- neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE);
+ neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE, GNUNET_NO);
}