From d13a6dfd0f7a8ebc98cdb59cf0a04a282fa1593d Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Mon, 8 Aug 2016 13:37:30 +0200 Subject: ipcpd: normal: Allow exchange of static DIF information This adds the functionality of exchanging the static DIF information between 2 DIF members. After exchange the enrollment is stopped, and the IPCP that initiated enrollment transitions to the enrolled state. --- src/ipcpd/normal/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/normal/main.c') diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 57fb72df..2d416942 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -146,7 +146,14 @@ static int normal_ipcp_enroll(char * dif_name) return -1; } - /* FIXME: Wait until state changed to ENROLLED */ + /* FIXME: Wait passively until state changed to ENROLLED */ + pthread_rwlock_rdlock(&_ipcp->state_lock); + while (_ipcp->state != IPCP_ENROLLED) { + pthread_rwlock_unlock(&_ipcp->state_lock); + sched_yield(); + pthread_rwlock_rdlock(&_ipcp->state_lock); + } + pthread_rwlock_unlock(&_ipcp->state_lock); return 0; } -- cgit v1.2.3