Module: xenomai-3
Branch: next
Commit: dcd9821a3b9212270de2f503d83bd2d1a3999695
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dcd9821a3b9212270de2f503d83bd2d1a3999695

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Jul 31 15:00:48 2015 +0200

copperplate/regd: do timed wait for anon connection

---

 lib/copperplate/regd/regd.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/copperplate/regd/regd.c b/lib/copperplate/regd/regd.c
index 4f48273..01ecc60 100644
--- a/lib/copperplate/regd/regd.c
+++ b/lib/copperplate/regd/regd.c
@@ -343,7 +343,7 @@ static void handle_requests(void)
        FD_ZERO(&refset);
        FD_SET(sockfd, &refset);
 
-       if (!(linger || anon)) {
+       if (!linger) {
                tmfd = __STD(timerfd_create(CLOCK_MONOTONIC, 0));
                if (tmfd < 0)
                        error(1, errno, "handle_requests/timerfd_create");
@@ -371,8 +371,14 @@ static void handle_requests(void)
                                continue;
                        }
                        FD_SET(s, &refset);
-                       if (tmfd != -1)
-                               __STD(timerfd_settime(tmfd, 0, &its, NULL));
+                       if (tmfd != -1) {
+                               if (anon) {
+                                       FD_CLR(tmfd, &refset);
+                                       __STD(close(tmfd));
+                                       tmfd = -1;
+                               } else
+                                       __STD(timerfd_settime(tmfd, 0, &its, 
NULL));
+                       }
                }
                if (tmfd != -1 && FD_ISSET(tmfd, &set)) {
                        ret = __STD(read(tmfd, &exp, sizeof(exp)));


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to