aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_unix.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:42:54 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-10-16 11:42:54 +0000
commita0c440498665c82e595a7a5e19125cdbd75b0586 (patch)
treec8985308c2d2cc39cd221b3e77f1d8c3313565a2 /src/transport/plugin_transport_unix.c
parent77990e170e992a745b7edde92fbb705247ab83e8 (diff)
downloadgnunet-a0c440498665c82e595a7a5e19125cdbd75b0586.tar.gz
gnunet-a0c440498665c82e595a7a5e19125cdbd75b0586.zip
fix for overhead measurement in unix,also fixes assertion in neighbours 1152
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r--src/transport/plugin_transport_unix.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 5fda1191a..c03d198c2 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -104,6 +104,7 @@ struct UNIXMessageWrapper
104 104
105 struct UNIXMessage * msg; 105 struct UNIXMessage * msg;
106 size_t msgsize; 106 size_t msgsize;
107 size_t payload;
107 108
108 struct GNUNET_TIME_Relative timeout; 109 struct GNUNET_TIME_Relative timeout;
109 unsigned int priority; 110 unsigned int priority;
@@ -378,7 +379,7 @@ disconnect_session (struct Session *s)
378 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); 379 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
379 if (NULL != msgw->cont) 380 if (NULL != msgw->cont)
380 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR, 381 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR,
381 msgw->msgsize, 0); 382 msgw->payload, 0);
382 GNUNET_free (msgw->msg); 383 GNUNET_free (msgw->msg);
383 GNUNET_free (msgw); 384 GNUNET_free (msgw);
384 removed = GNUNET_YES; 385 removed = GNUNET_YES;
@@ -444,7 +445,7 @@ unix_transport_server_stop (void *cls)
444 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw); 445 GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
445 if (msgw->cont != NULL) 446 if (msgw->cont != NULL)
446 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR, 447 msgw->cont (msgw->cont_cls, &msgw->session->target, GNUNET_SYSERR,
447 msgw->msgsize, 0); 448 msgw->payload, 0);
448 GNUNET_free (msgw->msg); 449 GNUNET_free (msgw->msg);
449 GNUNET_free (msgw); 450 GNUNET_free (msgw);
450 } 451 }
@@ -492,8 +493,11 @@ unix_real_send (void *cls,
492 struct GNUNET_NETWORK_Handle *send_handle, 493 struct GNUNET_NETWORK_Handle *send_handle,
493 const struct GNUNET_PeerIdentity *target, const char *msgbuf, 494 const struct GNUNET_PeerIdentity *target, const char *msgbuf,
494 size_t msgbuf_size, unsigned int priority, 495 size_t msgbuf_size, unsigned int priority,
495 struct GNUNET_TIME_Relative timeout, const void *addr, 496 struct GNUNET_TIME_Relative timeout,
496 size_t addrlen, GNUNET_TRANSPORT_TransmitContinuation cont, 497 const void *addr,
498 size_t addrlen,
499 size_t payload,
500 GNUNET_TRANSPORT_TransmitContinuation cont,
497 void *cont_cls) 501 void *cont_cls)
498{ 502{
499 struct Plugin *plugin = cls; 503 struct Plugin *plugin = cls;
@@ -510,7 +514,7 @@ unix_real_send (void *cls,
510 /* We do not have a send handle */ 514 /* We do not have a send handle */
511 GNUNET_break (0); 515 GNUNET_break (0);
512 if (cont != NULL) 516 if (cont != NULL)
513 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0); 517 cont (cont_cls, target, GNUNET_SYSERR, payload, 0);
514 return -1; 518 return -1;
515 } 519 }
516 if ((addr == NULL) || (addrlen == 0)) 520 if ((addr == NULL) || (addrlen == 0))
@@ -518,7 +522,7 @@ unix_real_send (void *cls,
518 /* Can never send if we don't have an address */ 522 /* Can never send if we don't have an address */
519 GNUNET_break (0); 523 GNUNET_break (0);
520 if (cont != NULL) 524 if (cont != NULL)
521 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0); 525 cont (cont_cls, target, GNUNET_SYSERR, payload, 0);
522 return -1; 526 return -1;
523 } 527 }
524 528
@@ -600,9 +604,9 @@ unix_real_send (void *cls,
600 if (cont != NULL) 604 if (cont != NULL)
601 { 605 {
602 if (sent == GNUNET_SYSERR) 606 if (sent == GNUNET_SYSERR)
603 cont (cont_cls, target, GNUNET_SYSERR, msgbuf_size, 0); 607 cont (cont_cls, target, GNUNET_SYSERR, payload, 0);
604 if (sent > 0) 608 if (sent > 0)
605 cont (cont_cls, target, GNUNET_OK, msgbuf_size, msgbuf_size); 609 cont (cont_cls, target, GNUNET_OK, payload, msgbuf_size);
606 } 610 }
607 611
608 /* return number of bytes successfully sent */ 612 /* return number of bytes successfully sent */
@@ -781,6 +785,7 @@ unix_plugin_send (void *cls,
781 wrapper = GNUNET_malloc (sizeof (struct UNIXMessageWrapper)); 785 wrapper = GNUNET_malloc (sizeof (struct UNIXMessageWrapper));
782 wrapper->msg = message; 786 wrapper->msg = message;
783 wrapper->msgsize = ssize; 787 wrapper->msgsize = ssize;
788 wrapper->payload = msgbuf_size;
784 wrapper->priority = priority; 789 wrapper->priority = priority;
785 wrapper->timeout = to; 790 wrapper->timeout = to;
786 wrapper->cont = cont; 791 wrapper->cont = cont;
@@ -936,6 +941,7 @@ unix_plugin_select_write (struct Plugin * plugin)
936 msgw->timeout, 941 msgw->timeout,
937 msgw->session->addr, 942 msgw->session->addr,
938 msgw->session->addrlen, 943 msgw->session->addrlen,
944 msgw->payload,
939 msgw->cont, msgw->cont_cls); 945 msgw->cont, msgw->cont_cls);
940 946
941 if (sent == 0) 947 if (sent == 0)