[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Opaque data on callback?



Thanks for the response, Kelly.

Kelly wrote:

> 	Perhaps I'm missing something but the callback for async dns is:
> 
> _lookup_response( int errCode, struct evutil_addrinfo* info, void* data )
> 
> Where the "data" member is what you pass into evdns_getaddrinfo and can be
> anything you want.  So, you already have a place to put your context don't
> you?

Ah, I got "thwarted" by the example code, which passed the name being
looked up as both the "nodename" (2nd arg) and the final void* arg.

I read the code too quickly (and not closely enough) - now that I know I
can use the final void* arg for my private context I should be fine.

Thanks very much!

H
--
> > I'm new to libevent...
> > 
> > I'm writing an app that needs async DNS.  While I have the core of this
> > working, I have some "private data" that I want to associate with each
> > name that is being looked up, so it would be Swell if the
> > evutil_addrinfo was actually a structure that contained:
> > 
> > - a void pointer for private data
> > - a struct addrinfo
> > 
> > so in my callback function I could use the private data pointer to
> > easily and quickly access some context information about the answer I
> > just got.
> > 
> > Or something functionally equivalent.
> > 
> > Suggestions?
> > --
> > Harlan Stenn <stenn@xxxxxxx>
> > http://ntpforum.isc.org  - be a member!
> > ***********************************************************************
> > To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> > unsubscribe libevent-users    in the body.
> 
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.