diff options
Diffstat (limited to 'src/transport/transport_api2_communication.c')
-rw-r--r-- | src/transport/transport_api2_communication.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index 33092fb2a..6d497c967 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -906,6 +906,9 @@ GNUNET_TRANSPORT_communicator_disconnect (struct GNUNET_TRANSPORT_CommunicatorHa | |||
906 | * @param sender presumed sender of the message (details to be checked | 906 | * @param sender presumed sender of the message (details to be checked |
907 | * by higher layers) | 907 | * by higher layers) |
908 | * @param msg the message | 908 | * @param msg the message |
909 | * @param expected_addr_validity how long does the communicator believe it | ||
910 | * will continue to be able to receive messages from the same address | ||
911 | * on which it received this message? | ||
909 | * @param cb function to call once handling the message is done, NULL if | 912 | * @param cb function to call once handling the message is done, NULL if |
910 | * flow control is not supported by this communicator | 913 | * flow control is not supported by this communicator |
911 | * @param cb_cls closure for @a cb | 914 | * @param cb_cls closure for @a cb |
@@ -919,6 +922,7 @@ int | |||
919 | GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, | 922 | GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, |
920 | const struct GNUNET_PeerIdentity *sender, | 923 | const struct GNUNET_PeerIdentity *sender, |
921 | const struct GNUNET_MessageHeader *msg, | 924 | const struct GNUNET_MessageHeader *msg, |
925 | struct GNUNET_TIME_Relative expected_addr_validity, | ||
922 | GNUNET_TRANSPORT_MessageCompletedCallback cb, | 926 | GNUNET_TRANSPORT_MessageCompletedCallback cb, |
923 | void *cb_cls) | 927 | void *cb_cls) |
924 | { | 928 | { |
@@ -932,24 +936,25 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
932 | (GNUNET_MQ_get_length (ch->mq) >= ch->max_queue_length) ) | 936 | (GNUNET_MQ_get_length (ch->mq) >= ch->max_queue_length) ) |
933 | { | 937 | { |
934 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 938 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
935 | "Dropping message: transprot is too slow, queue length %llu exceeded\n", | 939 | "Dropping message: transprot is too slow, queue length %llu exceeded\n", |
936 | ch->max_queue_length); | 940 | ch->max_queue_length); |
937 | return GNUNET_NO; | 941 | return GNUNET_NO; |
938 | } | 942 | } |
939 | 943 | ||
940 | msize = ntohs (msg->size); | 944 | msize = ntohs (msg->size); |
941 | env = GNUNET_MQ_msg_extra (im, | 945 | env = GNUNET_MQ_msg_extra (im, |
942 | msize, | 946 | msize, |
943 | GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG); | 947 | GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG); |
944 | if (NULL == env) | 948 | if (NULL == env) |
945 | { | 949 | { |
946 | GNUNET_break (0); | 950 | GNUNET_break (0); |
947 | return GNUNET_SYSERR; | 951 | return GNUNET_SYSERR; |
948 | } | 952 | } |
953 | im->expected_address_validity = GNUNET_TIME_relative_hton (expected_addr_validity); | ||
949 | im->sender = *sender; | 954 | im->sender = *sender; |
950 | memcpy (&im[1], | 955 | memcpy (&im[1], |
951 | msg, | 956 | msg, |
952 | msize); | 957 | msize); |
953 | if (NULL != cb) | 958 | if (NULL != cb) |
954 | { | 959 | { |
955 | struct FlowControl *fc; | 960 | struct FlowControl *fc; |
@@ -962,11 +967,11 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
962 | fc->cb = cb; | 967 | fc->cb = cb; |
963 | fc->cb_cls = cb_cls; | 968 | fc->cb_cls = cb_cls; |
964 | GNUNET_CONTAINER_DLL_insert (ch->fc_head, | 969 | GNUNET_CONTAINER_DLL_insert (ch->fc_head, |
965 | ch->fc_tail, | 970 | ch->fc_tail, |
966 | fc); | 971 | fc); |
967 | } | 972 | } |
968 | GNUNET_MQ_send (ch->mq, | 973 | GNUNET_MQ_send (ch->mq, |
969 | env); | 974 | env); |
970 | return GNUNET_OK; | 975 | return GNUNET_OK; |
971 | } | 976 | } |
972 | 977 | ||