commit 3f629af07eda95b91b78c97b3d5a39a878fbb95d
Author: Oswald Buddenhagen <[email protected]>
Date:   Sun Nov 30 19:51:21 2014 +0100

    remove support for faking notifications
    
    with the existence of timers, this is now superfluous.

 src/common.h |    2 --
 src/util.c   |   29 ++++++++++++++---------------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/common.h b/src/common.h
index d10a791..f9454cb 100644
--- a/src/common.h
+++ b/src/common.h
@@ -140,7 +140,6 @@ typedef struct notifier {
 #else
        int fd, events;
 #endif
-       int faked;
 } notifier_t;
 
 #ifdef HAVE_SYS_POLL_H
@@ -153,7 +152,6 @@ typedef struct notifier {
 
 void init_notifier( notifier_t *sn, int fd, void (*cb)( int, void * ), void 
*aux );
 void conf_notifier( notifier_t *sn, int and_events, int or_events );
-static INLINE void fake_notifier( notifier_t *sn, int events ) { sn->faked |= 
events; }
 void wipe_notifier( notifier_t *sn );
 
 typedef struct {
diff --git a/src/util.c b/src/util.c
index d3448c5..3511cc5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -636,7 +636,6 @@ init_notifier( notifier_t *sn, int fd, void (*cb)( int, 
void * ), void *aux )
 #endif
        sn->cb = cb;
        sn->aux = aux;
-       sn->faked = 0;
        sn->next = notifiers;
        notifiers = sn;
 }
@@ -762,20 +761,19 @@ event_wait( void )
                }
                timeout = delta * 1000;
        }
-       for (sn = notifiers; sn; sn = sn->next)
-               if (sn->faked) {
-                       timeout = 0;
-                       break;
-               }
-       if (poll( pollfds, npolls, timeout ) < 0) {
+       switch (poll( pollfds, npolls, timeout )) {
+       case 0:
+               return;
+       case -1:
                perror( "poll() failed in event loop" );
                abort();
+       default:
+               break;
        }
        for (sn = notifiers; sn; sn = sn->next) {
                int n = sn->index;
-               if ((m = pollfds[n].revents | sn->faked)) {
+               if ((m = pollfds[n].revents)) {
                        assert( !(m & POLLNVAL) );
-                       sn->faked = 0;
                        sn->cb( m | shifted_bit( m, POLLHUP, POLLIN ), sn->aux 
);
                        if (changed) {
                                changed = 0;
@@ -786,7 +784,6 @@ event_wait( void )
 #else
        struct timeval *timeout = 0;
        struct timeval to_tv;
-       static struct timeval null_tv;
        fd_set rfds, wfds, efds;
        int fd;
 
@@ -808,8 +805,6 @@ event_wait( void )
        FD_ZERO( &efds );
        m = -1;
        for (sn = notifiers; sn; sn = sn->next) {
-               if (sn->faked)
-                       timeout = &null_tv;
                fd = sn->fd;
                if (sn->events & POLLIN)
                        FD_SET( fd, &rfds );
@@ -819,13 +814,18 @@ event_wait( void )
                if (fd > m)
                        m = fd;
        }
-       if (select( m + 1, &rfds, &wfds, &efds, timeout ) < 0) {
+       switch (select( m + 1, &rfds, &wfds, &efds, timeout )) {
+       case 0:
+               return;
+       case -1:
                perror( "select() failed in event loop" );
                abort();
+       default:
+               break;
        }
        for (sn = notifiers; sn; sn = sn->next) {
                fd = sn->fd;
-               m = sn->faked;
+               m = 0;
                if (FD_ISSET( fd, &rfds ))
                        m |= POLLIN;
                if (FD_ISSET( fd, &wfds ))
@@ -833,7 +833,6 @@ event_wait( void )
                if (FD_ISSET( fd, &efds ))
                        m |= POLLERR;
                if (m) {
-                       sn->faked = 0;
                        sn->cb( m, sn->aux );
                        if (changed) {
                                changed = 0;

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to