--- cvsroot/EV/EV.xs 2007/10/26 18:21:32 1.4 +++ cvsroot/EV/EV.xs 2007/10/27 19:11:27 1.8 @@ -118,7 +118,7 @@ { double now = e_now (); - if (now > to && ev->interval) + if (ev->interval) ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval); to -= now; @@ -171,7 +171,7 @@ ENTER; SAVETMPS; - if (!(ev->ev.ev_events & EV_PERSIST)) + if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT)) ev->active = 0; PUSHMARK (SP); @@ -180,12 +180,19 @@ PUSHs (sv_2mortal (newSViv (events))); PUTBACK; call_sv (ev->cb, G_DISCARD | G_VOID | G_EVAL); - /*TODO: if err, call some logging function */ if (ev->interval && !ev->active) e_start (ev); FREETMPS; + + if (SvTRUE (ERRSV)) + { + PUSHMARK (SP); + PUTBACK; + call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); + } + LEAVE; } @@ -230,6 +237,14 @@ call_sv (sv_2mortal (cb), G_DISCARD | G_VOID | G_EVAL); FREETMPS; + + if (SvTRUE (ERRSV)) + { + PUSHMARK (SP); + PUTBACK; + call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR); + } + LEAVE; } @@ -482,7 +497,6 @@ IV iv; } *civ, const_iv[] = { # define const_iv(pfx, name) { # name, (IV) pfx ## name }, - const_iv (DNS_, ERR_NONE) const_iv (DNS_, ERR_FORMAT) const_iv (DNS_, ERR_SERVERFAILED) @@ -538,7 +552,7 @@ STRLEN len; char *data = SvPVbyte (addr, len); if (len != (ix ? 16 : 4)) - croak ("ipv4/ipv6 address to resolve must be given as 4/16 byte octet string"); + croak ("ipv4/ipv6 address to be resolved must be given as 4/16 byte octet string"); RETVAL = ix ? evdns_resolve_reverse_ipv6 ((struct in6_addr *)data, flags, dns_cb, (void *)SvREFCNT_inc (cb)) @@ -563,3 +577,49 @@ void evdns_search_ndots_set (int ndots) + +MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_ + +BOOT: +{ + HV *stash = gv_stashpv ("EV::HTTP", 1); + + static const struct { + const char *name; + IV iv; + } *civ, const_iv[] = { +# define const_iv(pfx, name) { # name, (IV) pfx ## name }, + const_iv (HTTP_, OK) + const_iv (HTTP_, NOCONTENT) + const_iv (HTTP_, MOVEPERM) + const_iv (HTTP_, MOVETEMP) + const_iv (HTTP_, NOTMODIFIED) + const_iv (HTTP_, BADREQUEST) + const_iv (HTTP_, NOTFOUND) + const_iv (HTTP_, SERVUNAVAIL) + const_iv (EVHTTP_, REQ_OWN_CONNECTION) + const_iv (EVHTTP_, PROXY_REQUEST) + const_iv (EVHTTP_, REQ_GET) + const_iv (EVHTTP_, REQ_POST) + const_iv (EVHTTP_, REQ_HEAD) + const_iv (EVHTTP_, REQUEST) + const_iv (EVHTTP_, RESPONSE) + }; + + for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) + newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); +} + +MODULE = EV PACKAGE = EV::HTTP::Request PREFIX = evhttp_request_ + +#HttpRequest new (SV *klass, SV *cb) + +#void DESTROY (struct evhttp_request *req); + + + + + + + +