Fix node_timer bug; sometimes was not initializing watcher
This commit is contained in:
parent
c857d65dd3
commit
b571900d9c
@ -149,8 +149,10 @@ Handle<Value> Timer::Again(const Arguments& args) {
|
|||||||
|
|
||||||
int was_active = ev_is_active(&timer->watcher_);
|
int was_active = ev_is_active(&timer->watcher_);
|
||||||
|
|
||||||
ev_tstamp repeat = NODE_V8_UNIXTIME(args[0]);
|
if (args.Length() > 0) {
|
||||||
if (repeat > 0) timer->watcher_.repeat = repeat;
|
ev_tstamp repeat = NODE_V8_UNIXTIME(args[0]);
|
||||||
|
if (repeat > 0) timer->watcher_.repeat = repeat;
|
||||||
|
}
|
||||||
|
|
||||||
ev_timer_again(EV_DEFAULT_UC_ &timer->watcher_);
|
ev_timer_again(EV_DEFAULT_UC_ &timer->watcher_);
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@ class Timer : ObjectWrap {
|
|||||||
protected:
|
protected:
|
||||||
static v8::Persistent<v8::FunctionTemplate> constructor_template;
|
static v8::Persistent<v8::FunctionTemplate> constructor_template;
|
||||||
|
|
||||||
Timer () : ObjectWrap () { }
|
Timer () : ObjectWrap () {
|
||||||
|
// dummy timeout values
|
||||||
|
ev_timer_init(&watcher_, OnTimeout, 0., 1.);
|
||||||
|
}
|
||||||
~Timer();
|
~Timer();
|
||||||
|
|
||||||
static v8::Handle<v8::Value> New (const v8::Arguments& args);
|
static v8::Handle<v8::Value> New (const v8::Arguments& args);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user