summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-03-06 15:15:51 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-03-08 17:40:17 +0100
commit40ca5385e97f393d0c231446f117ad43465735a7 (patch)
tree019bfcefe5899c545403648807372d7b2e97ee73 /src/ipcpd/unicast
parent22526848c5a7b48f8b45988bdfbc6e0ce7a9f712 (diff)
downloadouroboros-40ca5385e97f393d0c231446f117ad43465735a7.tar.gz
ouroboros-40ca5385e97f393d0c231446f117ad43465735a7.zip
ipdpd: Pass MPL to application at flow_allocation
The maximum packet lifetime (MPL) is a property of the flow that needs to be passed to the reliable transmission protocol (FRCP) for its correct operation. Previously, the value of MPL was set fixed as one of the (fixed) Delta-t parameters. This patch makes the MPL a property of the layer, and it can now be set per layer-type at build time. This is a step towards a proper MPL estimator in the flow allocator. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast')
-rw-r--r--src/ipcpd/unicast/CMakeLists.txt2
-rw-r--r--src/ipcpd/unicast/fa.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ipcpd/unicast/CMakeLists.txt b/src/ipcpd/unicast/CMakeLists.txt
index f4887160..e1fe1074 100644
--- a/src/ipcpd/unicast/CMakeLists.txt
+++ b/src/ipcpd/unicast/CMakeLists.txt
@@ -13,6 +13,8 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_BINARY_DIR}/include)
set(IPCP_UNICAST_TARGET ipcpd-unicast CACHE INTERNAL "")
+set(IPCP_UNICAST_MPL 60 CACHE STRING
+ "Default maximum packet lifetime for the unicast IPCP, in seconds")
protobuf_generate_c(KAD_PROTO_SRCS KAD_PROTO_HDRS dir/kademlia.proto)
diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c
index d59b9760..eb467a90 100644
--- a/src/ipcpd/unicast/fa.c
+++ b/src/ipcpd/unicast/fa.c
@@ -477,6 +477,7 @@ static int fa_wait_irmd_alloc(uint8_t * dst,
struct timespec ts = {0, TIMEOUT * 1000};
struct timespec abstime;
int fd;
+ time_t mpl = IPCP_UNICAST_MPL;
clock_gettime(PTHREAD_COND_CLOCK, &abstime);
@@ -497,7 +498,7 @@ static int fa_wait_irmd_alloc(uint8_t * dst,
assert(ipcpi.alloc_id == -1);
- fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, data, len);
+ fd = ipcp_flow_req_arr(dst, ipcp_dir_hash_len(), qs, mpl, data, len);
if (fd < 0) {
pthread_mutex_unlock(&ipcpi.alloc_lock);
log_dbg("Failed to get fd for flow.");
@@ -598,6 +599,7 @@ static int fa_handle_flow_reply(struct fa_msg * msg,
struct fa_flow * flow;
uint8_t * data; /* Piggbacked data on flow alloc request. */
size_t dlen; /* Length of piggybacked data. */
+ time_t mpl = IPCP_UNICAST_MPL;
assert(len >= sizeof(*msg));
@@ -623,7 +625,7 @@ static int fa_handle_flow_reply(struct fa_msg * msg,
pthread_rwlock_unlock(&fa.flows_lock);
- if (ipcp_flow_alloc_reply(fd, msg->response, data, dlen))
+ if (ipcp_flow_alloc_reply(fd, msg->response, mpl, data, dlen))
return -EIRMD;
return 0;