[Xenomai-git] Philippe Gerum : copperplate/regd: do timed wait for anon connection
Module: xenomai-3 Branch: master Commit: dcd9821a3b9212270de2f503d83bd2d1a3999695 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dcd9821a3b9212270de2f503d83bd2d1a3999695 Author: Philippe Gerum 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
[Xenomai-git] Philippe Gerum : copperplate/regd: do timed wait for anon connection
Module: xenomai-3 Branch: next Commit: dcd9821a3b9212270de2f503d83bd2d1a3999695 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dcd9821a3b9212270de2f503d83bd2d1a3999695 Author: Philippe Gerum 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
[Xenomai-git] Philippe Gerum : copperplate/regd: do timed wait for anon connection
Module: xenomai-3 Branch: next Commit: f6e8d20f45fab08dd87ffd38d9fb146e94e24571 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f6e8d20f45fab08dd87ffd38d9fb146e94e24571 Author: Philippe Gerum 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