summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-08-08 13:37:30 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-08-08 14:33:31 +0200
commitd13a6dfd0f7a8ebc98cdb59cf0a04a282fa1593d (patch)
treeae9898536ee5767080b39e82806804fbf9911605 /src/ipcpd/normal/main.c
parent3c80fae407f451691a4a4178617986e32d0c8162 (diff)
downloadouroboros-d13a6dfd0f7a8ebc98cdb59cf0a04a282fa1593d.tar.gz
ouroboros-d13a6dfd0f7a8ebc98cdb59cf0a04a282fa1593d.zip
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.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c9
1 files changed, 8 insertions, 1 deletions
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;
}