Re: [Libevent-users] New DNS Resolver
On Feb 28, 2009, at 12:32 PM, William Ahern wrote: Don't mean to whore myself, but perhaps some will find this useful (and more importantly, send patches). A recursive (also stub), reentrant, non- blocking DNS resolver in a single .c file: http://25thandclement.com/~william/projects/dns.c.html ... awesome! About time a DNS library had been written this way. It'll be nice to have async DNS that'll work with libev/libevent as available. Side note: seems to work perfectly fine in OSX 10.5.6 ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] callback firing many (infinite) times for stdin
On Nov 6, 2008, at 1:30 PM, Richard Jones wrote: .. i see: Read 5 bytes from 0:'12345' Read 0 bytes from 0:'' Read 0 bytes from 0:'' Read 0 bytes from 0:'' ... And the callback keeps firing forever, even tho I'm not sending any more data. I can't find anything in the docs about having to acknowledge events or dismiss them once fired or anything - what am i missing? The successful read of zero bytes indicates end-of-stream. smime.p7s Description: S/MIME cryptographic signature ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] Wrapping C++ hidden in C, good for uptake, or is any C++ frowned upon (for my Lumina networking library)
After thinking through some potential issues, particularly permitting others to integrate and extend libraries, I found the major killer for C++ libraries.. (especially on Windows where there's competing VC++ versions as well as MinGW) ABI incompatibility. I 'might' think of integrating boost's asio, but that would be hidden from the C API (perhaps selectable through some configuration setup)... I hope that C++-(whatever's next) will usher in ABI compatibility... but that may be wishing too much. Just wondering, is there any useful languages on top of C that would help code this, perhaps some preprocessing tools that would help take care of some gruntwork... or perhaps some sort of light C library that helps w/ object-orientation... On Sep 6, 2008, at 1:16 AM, Adrian Chadd wrote: On Sat, Sep 06, 2008, Thomas Harning Jr. wrote: I'm looking at developing a networking framework somewhat styled after what Mina offers in Java.. but native and optionally scriptable through wrappers. [snip] I've recently done some work in C++ and got the taste of the compacting of certain management tasks into small type-safe pieces of code. boost::asio seems relatively sane; perhaps you want to check out their API and internals? Adrian ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
[Libevent-users] Wrapping C++ hidden in C, good for uptake, or is any C++ frowned upon (for my Lumina networking library)
I'm looking at developing a networking framework somewhat styled after what Mina offers in Java.. but native and optionally scriptable through wrappers. I've been looking at doing it in C, but there seems to be so much extra overhead while implementing data hiding, custom memory management, and some basic inheritance. I've recently done some work in C++ and got the taste of the compacting of certain management tasks into small type-safe pieces of code. I'm hoping that when my library is in good shape that other open-source developers can consume it, however I've often seen that C++ is viewed as "evil" and avoided in any projects. Since I plan on using libev and/or libevent pieces, I figured that the project may be of the most use to subscribers of this list I figured I'd poll you all Basically the plan is to develop objects in this fashion: * C Interface w/ either publicly exposed structs, or typedefs for structs not-yet-defines. + usage functions * C++ Implementation Interface inheriting/implementing from structs in C interface * C function implementation calling the C++ implementation interface functions * C++ Implementation - actual guts Example: IoAccepter.h: struct IoAccepter { IoManager *manager; IoHandler *handler; }; IoAccepter *IoAccepter_new(IoManager *manager, IoHandler *handler); int IoAccepter_bind(IoAccepter *accepter, const struct sockaddr *addr, socklen_t addr_len); IoAccepter.hpp: class IoAccepter_impl : public IoAccepter { public: IoAccepter(IoManager *manager, IoHandler *handler); int bind(const struct sockaddr *addr, socklen_t addr_len); private: /* already-bound sockets -> addresses ... */ } /* binding layer */ extern "C" { IoAccepter *IoAccepter_new(IoManager *manager, IoHandler *handler) { return new IoAccepter_impl(manager, handler); } int IoAccepter_bind(IoAccepter *accepter, const struct sockaddr *addr, socklen_t addr_len) { return ((IoAccepter_impl*)accepter)->bind(addr, addr_len); } IoAccepter.cpp . deeper impl Any views on this... perhaps there's a better solution I hadn't thought of. (I've seen glib and its large set of utilities for object-orientation in C... but it seems just too large and clunky) -- Thomas Harning Jr. ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] SSL enabling libevent programs, is there an example available?
Ron Arts wrote: Hi, subject says it all. If there's no example with libevent, can someone recommend another place to look? I tried Googling but couldn't find a concise example. For example, w/ OpenSSL you can turn the socket to be non-blocking and watch for what openssl 'needs' after a failed attempt to read/write... Ex: int ret = SSL_read(ssl, buffer, len); if(ret < 0) { int err = SSL_get_error(ret); switch(err) { case SSL_ERROR_WANT_WRITE: /* Hook up libevent to wait on write then retry w/ exact same argument */ break; case SSL_ERROR_WANT_READ: /* Hook up libevent to wait on read then ... */ break; default: /* Something else. */ } } ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] Segfault when attempting to add more than ~1012 events
On 6/14/07, Niels Provos <[EMAIL PROTECTED]> wrote: What happens when you run the benchmark program (bench) with -n 2000? Niels. Hrm... states that setrlimit is not permitted by my user... As root.. nothing bad happens... Not sure what the issue is then..... -- Thomas Harning Jr. ___ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users
Re: [Libevent-users] Segfault when attempting to add more than ~1012 events
On 6/12/07, William Ahern <[EMAIL PROTECTED]> wrote: On Tue, Jun 12, 2007 at 10:49:25PM -0400, Thomas Harning Jr. wrote: ... > Log: > http://rafb.net/p/34ZA4i22.html Is libevent using select(2)? This sounds suspicously like an issue with the size of the fd_set structure/array. 1012 is about when C-Ares blows up, an async DNS library which takes fd_set's as parameters to its churn function. Nope.. its using epoll... @ line ~14 in the log it shows that its calling into epoll (+ when I ran `strace` it was using epoll...) -- Thomas Harning Jr. ___ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users
[Libevent-users] Segfault when attempting to add more than ~1012 events
I've been testing out a Lua binding to libevent ( http://luaforge.net/projects/luaevent/) and found a strange segfault & memory access error in libevent when adding ~1012 events... I wrote a really simple test case and have included output... I'm not sure on the policy for attachments for this mailing list, so here's links to the code/logs Source code http://rafb.net/p/RYHZ1I68.html Log: http://rafb.net/p/34ZA4i22.html -- Thomas Harning Jr. ___ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users