summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/sdu_sched.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-07-03 15:51:16 +0200
committerDimitri Staessens <dimitri.staessens@ugent.be>2018-07-04 16:16:41 +0200
commit301212fc967b51fd01e02c0dca8c9183db923b11 (patch)
tree4db76fb5977f0ecd34eb300a6375e1cf5d280497 /src/ipcpd/normal/sdu_sched.c
parentbedee0b0aac97fb195288ec81837e192cbb7b27c (diff)
downloadouroboros-301212fc967b51fd01e02c0dca8c9183db923b11.tar.gz
ouroboros-301212fc967b51fd01e02c0dca8c9183db923b11.zip
ipcpd: React to flow events actively
This adds the infrastructure to actively react to flow up, down and deallocated events. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/sdu_sched.c')
-rw-r--r--src/ipcpd/normal/sdu_sched.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/ipcpd/normal/sdu_sched.c b/src/ipcpd/normal/sdu_sched.c
index 0ae22895..6ce18ed5 100644
--- a/src/ipcpd/normal/sdu_sched.c
+++ b/src/ipcpd/normal/sdu_sched.c
@@ -25,9 +25,11 @@
#include "config.h"
#include <ouroboros/errno.h>
+#include <ouroboros/notifier.h>
#include "ipcp.h"
#include "sdu_sched.h"
+#include "connmgr.h"
#include <assert.h>
#include <sched.h>
@@ -86,10 +88,25 @@ static void * sdu_reader(void * o)
continue;
while ((fd = fqueue_next(fq)) >= 0) {
- if (ipcp_flow_read(fd, &sdb))
- continue;
-
- sched->callback(fd, qc, sdb);
+ switch (fqueue_type(fq)) {
+ case FLOW_DEALLOC:
+ notifier_event(NOTIFY_DT_FLOW_DEALLOC, &fd);
+ break;
+ case FLOW_DOWN:
+ notifier_event(NOTIFY_DT_FLOW_DOWN, &fd);
+ break;
+ case FLOW_UP:
+ notifier_event(NOTIFY_DT_FLOW_UP, &fd);
+ break;
+ case FLOW_PKT:
+ if (ipcp_flow_read(fd, &sdb))
+ continue;
+
+ sched->callback(fd, qc, sdb);
+ break;
+ default:
+ break;
+ }
}
}