fixed libev compiler errors

This commit is contained in:
Emiel Bruijntjes 2018-11-11 22:58:13 +01:00
parent d83e88b95d
commit 8d08916b8c
1 changed files with 8 additions and 10 deletions

View File

@ -281,9 +281,6 @@ private:
// initialize the libev structure // initialize the libev structure
ev_timer_init(&_timer, callback, timeout, timeout); ev_timer_init(&_timer, callback, timeout, timeout);
// and start it
ev_timer_start(_loop, &_timer);
// the timer should not keep the event loop active // the timer should not keep the event loop active
ev_unref(_loop); ev_unref(_loop);
} }
@ -309,11 +306,15 @@ private:
} }
/** /**
* Expose the selected heartbeat interval * Start the timer (and expose the interval)
* @return uint16_t * @return uint16_t
*/ */
uint16_t interval() const uint16_t start()
{ {
// start the timer
ev_timer_start(_loop, &_timer);
// expose the interval
return _interval; return _interval;
} }
@ -351,10 +352,7 @@ private:
for (auto &watcher : _watchers) for (auto &watcher : _watchers)
{ {
// do we have a match? // do we have a match?
if (watcher->fd() != fd) continue; if (watcher->contains(fd)) return watcher->events(events);
// change the events (and leap out)
return watcher->events(events);
} }
// we should monitor a new filedescriptor // we should monitor a new filedescriptor
@ -422,7 +420,7 @@ protected:
virtual uint16_t onNegotiate(TcpConnection *connection, uint16_t interval) override virtual uint16_t onNegotiate(TcpConnection *connection, uint16_t interval) override
{ {
// lookup the wrapper // lookup the wrapper
return lookup(connection)->interval(); return lookup(connection)->start();
} }
/** /**