Discussion:
How to interpret paramters to timeout callback?
(too old to reply)
Jeffrey Walton
2014-03-13 13:43:09 UTC
Permalink
Raw Message
I have a persistent timer. When its callback is invoked, I log the following:

timeout_cb: socket: -1; what: BEV_EVENT_READING; arg: 0x0x7362e0

Is a socket of -1 expected? If so, what is the purpose of the socket?

Why is BEV_EVENT_READING set? Shouldn't a timer set a
BEV_EVENT_TIMEOUT? Can I expect a BEV_EVENT_WRITING too?
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Nick Mathewson
2014-03-13 14:43:15 UTC
Permalink
Raw Message
Post by Jeffrey Walton
timeout_cb: socket: -1; what: BEV_EVENT_READING; arg: 0x0x7362e0
Is a socket of -1 expected? If so, what is the purpose of the socket?
The standard callback of an event takes a socket, a set of events, and
an argument. -1 indicates "no socket". Pure timeouts have no
sockets.
Post by Jeffrey Walton
Why is BEV_EVENT_READING set? Shouldn't a timer set a
BEV_EVENT_TIMEOUT? Can I expect a BEV_EVENT_WRITING too?
Sometimes numbers can mean more than one thing; that 1 isn't
BEV_EVENT_READING; it's EV_TIMEOUT. When you have an event callback,
the 'what' argument is a mask of EV_*, not BEV_EVENT_*.
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Jeffrey Walton
2014-03-13 15:37:09 UTC
Permalink
Raw Message
Post by Nick Mathewson
Post by Jeffrey Walton
timeout_cb: socket: -1; what: BEV_EVENT_READING; arg: 0x0x7362e0
Is a socket of -1 expected? If so, what is the purpose of the socket?
The standard callback of an event takes a socket, a set of events, and
an argument. -1 indicates "no socket". Pure timeouts have no
sockets.
Post by Jeffrey Walton
Why is BEV_EVENT_READING set? Shouldn't a timer set a
BEV_EVENT_TIMEOUT? Can I expect a BEV_EVENT_WRITING too?
Sometimes numbers can mean more than one thing; that 1 isn't
BEV_EVENT_READING; it's EV_TIMEOUT. When you have an event callback,
the 'what' argument is a mask of EV_*, not BEV_EVENT_*.
Perfect, thanks.
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.

Loading...