ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.xs
(Generate patch)

Comparing EV/EV.xs (file contents):
Revision 1.4 by root, Fri Oct 26 18:21:32 2007 UTC vs.
Revision 1.8 by root, Sat Oct 27 19:11:27 2007 UTC

116 116
117 if (ev->abstime) 117 if (ev->abstime)
118 { 118 {
119 double now = e_now (); 119 double now = e_now ();
120 120
121 if (now > to && ev->interval) 121 if (ev->interval)
122 ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval); 122 ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval);
123 123
124 to -= now; 124 to -= now;
125 } 125 }
126 else if (to < 0.) 126 else if (to < 0.)
169 dSP; 169 dSP;
170 170
171 ENTER; 171 ENTER;
172 SAVETMPS; 172 SAVETMPS;
173 173
174 if (!(ev->ev.ev_events & EV_PERSIST)) 174 if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT))
175 ev->active = 0; 175 ev->active = 0;
176 176
177 PUSHMARK (SP); 177 PUSHMARK (SP);
178 EXTEND (SP, 2); 178 EXTEND (SP, 2);
179 PUSHs (sv_2mortal (e_self (ev))); 179 PUSHs (sv_2mortal (e_self (ev)));
180 PUSHs (sv_2mortal (newSViv (events))); 180 PUSHs (sv_2mortal (newSViv (events)));
181 PUTBACK; 181 PUTBACK;
182 call_sv (ev->cb, G_DISCARD | G_VOID | G_EVAL); 182 call_sv (ev->cb, G_DISCARD | G_VOID | G_EVAL);
183 /*TODO: if err, call some logging function */
184 183
185 if (ev->interval && !ev->active) 184 if (ev->interval && !ev->active)
186 e_start (ev); 185 e_start (ev);
187 186
188 FREETMPS; 187 FREETMPS;
188
189 if (SvTRUE (ERRSV))
190 {
191 PUSHMARK (SP);
192 PUTBACK;
193 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
194 }
195
189 LEAVE; 196 LEAVE;
190} 197}
191 198
192///////////////////////////////////////////////////////////////////////////// 199/////////////////////////////////////////////////////////////////////////////
193// DNS 200// DNS
228 235
229 PUTBACK; 236 PUTBACK;
230 call_sv (sv_2mortal (cb), G_DISCARD | G_VOID | G_EVAL); 237 call_sv (sv_2mortal (cb), G_DISCARD | G_VOID | G_EVAL);
231 238
232 FREETMPS; 239 FREETMPS;
240
241 if (SvTRUE (ERRSV))
242 {
243 PUSHMARK (SP);
244 PUTBACK;
245 call_sv (get_sv ("EV::DIED", 1), G_DISCARD | G_VOID | G_EVAL | G_KEEPERR);
246 }
247
233 LEAVE; 248 LEAVE;
234} 249}
235 250
236///////////////////////////////////////////////////////////////////////////// 251/////////////////////////////////////////////////////////////////////////////
237// XS interface functions 252// XS interface functions
480 static const struct { 495 static const struct {
481 const char *name; 496 const char *name;
482 IV iv; 497 IV iv;
483 } *civ, const_iv[] = { 498 } *civ, const_iv[] = {
484# define const_iv(pfx, name) { # name, (IV) pfx ## name }, 499# define const_iv(pfx, name) { # name, (IV) pfx ## name },
485
486 const_iv (DNS_, ERR_NONE) 500 const_iv (DNS_, ERR_NONE)
487 const_iv (DNS_, ERR_FORMAT) 501 const_iv (DNS_, ERR_FORMAT)
488 const_iv (DNS_, ERR_SERVERFAILED) 502 const_iv (DNS_, ERR_SERVERFAILED)
489 const_iv (DNS_, ERR_NOTEXIST) 503 const_iv (DNS_, ERR_NOTEXIST)
490 const_iv (DNS_, ERR_NOTIMPL) 504 const_iv (DNS_, ERR_NOTIMPL)
536 CODE: 550 CODE:
537{ 551{
538 STRLEN len; 552 STRLEN len;
539 char *data = SvPVbyte (addr, len); 553 char *data = SvPVbyte (addr, len);
540 if (len != (ix ? 16 : 4)) 554 if (len != (ix ? 16 : 4))
541 croak ("ipv4/ipv6 address to resolve must be given as 4/16 byte octet string"); 555 croak ("ipv4/ipv6 address to be resolved must be given as 4/16 byte octet string");
542 556
543 RETVAL = ix 557 RETVAL = ix
544 ? evdns_resolve_reverse_ipv6 ((struct in6_addr *)data, flags, dns_cb, (void *)SvREFCNT_inc (cb)) 558 ? evdns_resolve_reverse_ipv6 ((struct in6_addr *)data, flags, dns_cb, (void *)SvREFCNT_inc (cb))
545 : evdns_resolve_reverse ((struct in_addr *)data, flags, dns_cb, (void *)SvREFCNT_inc (cb)); 559 : evdns_resolve_reverse ((struct in_addr *)data, flags, dns_cb, (void *)SvREFCNT_inc (cb));
546} 560}
561 575
562void evdns_search_add (char *domain) 576void evdns_search_add (char *domain)
563 577
564void evdns_search_ndots_set (int ndots) 578void evdns_search_ndots_set (int ndots)
565 579
580
581MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_
582
583BOOT:
584{
585 HV *stash = gv_stashpv ("EV::HTTP", 1);
586
587 static const struct {
588 const char *name;
589 IV iv;
590 } *civ, const_iv[] = {
591# define const_iv(pfx, name) { # name, (IV) pfx ## name },
592 const_iv (HTTP_, OK)
593 const_iv (HTTP_, NOCONTENT)
594 const_iv (HTTP_, MOVEPERM)
595 const_iv (HTTP_, MOVETEMP)
596 const_iv (HTTP_, NOTMODIFIED)
597 const_iv (HTTP_, BADREQUEST)
598 const_iv (HTTP_, NOTFOUND)
599 const_iv (HTTP_, SERVUNAVAIL)
600 const_iv (EVHTTP_, REQ_OWN_CONNECTION)
601 const_iv (EVHTTP_, PROXY_REQUEST)
602 const_iv (EVHTTP_, REQ_GET)
603 const_iv (EVHTTP_, REQ_POST)
604 const_iv (EVHTTP_, REQ_HEAD)
605 const_iv (EVHTTP_, REQUEST)
606 const_iv (EVHTTP_, RESPONSE)
607 };
608
609 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
610 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
611}
612
613MODULE = EV PACKAGE = EV::HTTP::Request PREFIX = evhttp_request_
614
615#HttpRequest new (SV *klass, SV *cb)
616
617#void DESTROY (struct evhttp_request *req);
618
619
620
621
622
623
624
625

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines