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

Comparing EV/EV.xs (file contents):
Revision 1.5 by root, Fri Oct 26 19:11:35 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
535 CODE: 550 CODE:
536{ 551{
537 STRLEN len; 552 STRLEN len;
538 char *data = SvPVbyte (addr, len); 553 char *data = SvPVbyte (addr, len);
539 if (len != (ix ? 16 : 4)) 554 if (len != (ix ? 16 : 4))
540 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");
541 556
542 RETVAL = ix 557 RETVAL = ix
543 ? 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))
544 : 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));
545} 560}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines