Re: event handling in OpenBGPd

2014-05-05 Thread Claudio Jeker
On Sun, May 04, 2014 at 10:39:33PM +0200, Vincent Gross wrote:
 Hi gang,
 
 I am considering to write a daemon of some kind, and I was going over
 OpenBGPd's sources to get some good fine-grained design examples. I
 noticed that although all IO's are asynchronous, libevent is not used,
 but I can't figure out why.
 
 So, is libevent not used by accident or by design ? in the latter case,
 what is precisely the feature/design consideration that made it
 unsuitable ?

Don't use bgpd as an example. It was one of the first privsep daemon we
did and at that time it was done without libevent. ospfd and all the later
daemons use libevent. Their event loop is therefor a lot simpler.
So yeah not using libevent in bgpd could be considered an accident.

-- 
:wq Claudio



Re: event handling in OpenBGPd

2014-05-05 Thread Henning Brauer
* Claudio Jeker cje...@diehard.n-r-g.com [2014-05-05 10:50]:
 On Sun, May 04, 2014 at 10:39:33PM +0200, Vincent Gross wrote:
  I am considering to write a daemon of some kind, and I was going over
  OpenBGPd's sources to get some good fine-grained design examples. I
  noticed that although all IO's are asynchronous, libevent is not used,
  but I can't figure out why.

I'm not a libevent-fan. So I didn't use it.

For bgpd, libevent+kqueue vs poll plain doesn't matter, the number of
sockets is too low.

  So, is libevent not used by accident or by design ? in the latter case,
  what is precisely the feature/design consideration that made it
  unsuitable ?
 Don't use bgpd as an example. It was one of the first privsep daemon we
 did and at that time it was done without libevent. ospfd and all the later
 daemons use libevent. Their event loop is therefor a lot simpler.
 So yeah not using libevent in bgpd could be considered an accident.

not an accident.

however, when I wrote the initial bgpd bits, I didn't think there
would be so many daemons using its framework 10 years later. so things
changed, and there's no problem with that.

wether you use libevent or not is a matter of taste imho unless we're
potentially dealing with a very large number of sockets, in which case
kqueue has advantages over poll.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services GmbH, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: event handling in OpenBGPd

2014-05-05 Thread Claudio Jeker
On Mon, May 05, 2014 at 12:28:38PM +0200, Henning Brauer wrote:
 * Claudio Jeker cje...@diehard.n-r-g.com [2014-05-05 10:50]:
  On Sun, May 04, 2014 at 10:39:33PM +0200, Vincent Gross wrote:
   I am considering to write a daemon of some kind, and I was going over
   OpenBGPd's sources to get some good fine-grained design examples. I
   noticed that although all IO's are asynchronous, libevent is not used,
   but I can't figure out why.
 
 I'm not a libevent-fan. So I didn't use it.
 
 For bgpd, libevent+kqueue vs poll plain doesn't matter, the number of
 sockets is too low.
 
   So, is libevent not used by accident or by design ? in the latter case,
   what is precisely the feature/design consideration that made it
   unsuitable ?
  Don't use bgpd as an example. It was one of the first privsep daemon we
  did and at that time it was done without libevent. ospfd and all the later
  daemons use libevent. Their event loop is therefor a lot simpler.
  So yeah not using libevent in bgpd could be considered an accident.
 
 not an accident.
 
 however, when I wrote the initial bgpd bits, I didn't think there
 would be so many daemons using its framework 10 years later. so things
 changed, and there's no problem with that.
 
 wether you use libevent or not is a matter of taste imho unless we're
 potentially dealing with a very large number of sockets, in which case
 kqueue has advantages over poll.
 

One of the big advantages of libevent is timeout handling for free. So you
don't need to reinvent it on top of poll(). When a daemon has to handle a
lot of different event sources libevent tends to be a lot easier since you
don't need to write all the timeout handling and there is also no need to
build up the pollfd array all by yourself.

-- 
:wq Claudio



event handling in OpenBGPd

2014-05-04 Thread Vincent Gross
Hi gang,

I am considering to write a daemon of some kind, and I was going over
OpenBGPd's sources to get some good fine-grained design examples. I
noticed that although all IO's are asynchronous, libevent is not used,
but I can't figure out why.

So, is libevent not used by accident or by design ? in the latter case,
what is precisely the feature/design consideration that made it
unsuitable ?

Cheers,

--
Vincent / dermiste