diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-08 14:33:44 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-08 14:33:44 +0000 |
commit | ff558cdccc61403fd674dddd6b6e46e5f9bedff9 (patch) | |
tree | af25f3f7a3ba0cd98f3c3a084d744871f8c5d0a1 /src/transport/gnunet-transport.c | |
parent | 583868404814e1d6ce050f19a30ece490824f56f (diff) | |
download | gnunet-ff558cdccc61403fd674dddd6b6e46e5f9bedff9.tar.gz gnunet-ff558cdccc61403fd674dddd6b6e46e5f9bedff9.zip |
- gnunet-transport improvement done
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r-- | src/transport/gnunet-transport.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index e125c5e56..521433467 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -515,6 +515,12 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
515 | if (verbosity > 0) | 515 | if (verbosity > 0) |
516 | FPRINTF (stdout, _("Successfully connected to `%s', starting to receive benchmark data\n"), | 516 | FPRINTF (stdout, _("Successfully connected to `%s', starting to receive benchmark data\n"), |
517 | GNUNET_i2s (&pid)); | 517 | GNUNET_i2s (&pid)); |
518 | if (GNUNET_SCHEDULER_NO_TASK != op_timeout) | ||
519 | { | ||
520 | GNUNET_SCHEDULER_cancel (op_timeout); | ||
521 | op_timeout = GNUNET_SCHEDULER_NO_TASK; | ||
522 | } | ||
523 | |||
518 | start_time = GNUNET_TIME_absolute_get (); | 524 | start_time = GNUNET_TIME_absolute_get (); |
519 | return; | 525 | return; |
520 | } | 526 | } |
@@ -616,9 +622,16 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
616 | { | 622 | { |
617 | if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type)) | 623 | if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type)) |
618 | return; | 624 | return; |
619 | if (verbosity > 0) | 625 | |
620 | FPRINTF (stdout, _("Received %u bytes from %s\n"), | 626 | if (0 == memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity))) |
621 | (unsigned int) ntohs (message->size), GNUNET_i2s (peer)); | 627 | { |
628 | if (verbosity > 0) | ||
629 | FPRINTF (stdout, _("Received %u bytes from %s\n"), | ||
630 | (unsigned int) ntohs (message->size), GNUNET_i2s (peer)); | ||
631 | } | ||
632 | else | ||
633 | /* Received data from other peer*/ return; | ||
634 | |||
622 | if (traffic_received == 0) | 635 | if (traffic_received == 0) |
623 | start_time = GNUNET_TIME_absolute_get (); | 636 | start_time = GNUNET_TIME_absolute_get (); |
624 | traffic_received += ntohs (message->size); | 637 | traffic_received += ntohs (message->size); |
@@ -740,16 +753,13 @@ testservice_task (void *cls, | |||
740 | return; | 753 | return; |
741 | } | 754 | } |
742 | 755 | ||
743 | end = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | ||
744 | &shutdown_task, | ||
745 | NULL); | ||
746 | |||
747 | if (try_connect) | 756 | if (try_connect) |
748 | { | 757 | { |
749 | if (NULL == cpid) | 758 | if (NULL == cpid) |
750 | { | 759 | { |
751 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | 760 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), |
752 | "-C", "-p"); | 761 | "-C", "-p"); |
762 | ret = 1; | ||
753 | return; | 763 | return; |
754 | } | 764 | } |
755 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, | 765 | handle = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, |
@@ -793,6 +803,13 @@ testservice_task (void *cls, | |||
793 | } | 803 | } |
794 | else if (benchmark_receive) /* Benchmark receiving */ | 804 | else if (benchmark_receive) /* Benchmark receiving */ |
795 | { | 805 | { |
806 | if (NULL == cpid) | ||
807 | { | ||
808 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | ||
809 | "-b", "-p"); | ||
810 | ret = 1; | ||
811 | return; | ||
812 | } | ||
796 | handle = | 813 | handle = |
797 | GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, | 814 | GNUNET_TRANSPORT_connect (cfg, NULL, NULL, ¬ify_receive, |
798 | ¬ify_connect, ¬ify_disconnect); | 815 | ¬ify_connect, ¬ify_disconnect); |
@@ -844,6 +861,11 @@ testservice_task (void *cls, | |||
844 | GNUNET_break (0); | 861 | GNUNET_break (0); |
845 | return; | 862 | return; |
846 | } | 863 | } |
864 | |||
865 | end = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | ||
866 | &shutdown_task, | ||
867 | NULL); | ||
868 | |||
847 | } | 869 | } |
848 | 870 | ||
849 | 871 | ||