Permalink
Browse files

Use MakeCallback

  • Loading branch information...
1 parent aa674f8 commit 111b14bd8de5ffe094c8dc91ae913183299a0896 @kkoopa kkoopa committed Feb 14, 2014
Showing with 6 additions and 9 deletions.
  1. +4 −4 binding.cc
  2. +2 −4 lib/index.js
  3. +0 −1 package.json
View
@@ -340,7 +340,7 @@ namespace zmq {
TryCatch try_catch;
- callback_v.As<Function>()->Call(NanObjectWrapHandle(this), 0, NULL);
+ MakeCallback(NanObjectWrapHandle(this), callback_v.As<Function>(), 0, NULL);
if (try_catch.HasCaught()) {
FatalException(try_catch);
@@ -373,7 +373,7 @@ namespace zmq {
TryCatch try_catch;
- callback_v.As<Function>()->Call(NanObjectWrapHandle(this), 3, argv);
+ MakeCallback(NanObjectWrapHandle(this), callback_v.As<Function>(), 3, argv);
if (try_catch.HasCaught()) {
FatalException(try_catch);
@@ -663,7 +663,7 @@ namespace zmq {
socket->endpoints += 1;
TryCatch try_catch;
- cb->Call(v8::Context::GetCurrent()->Global(), 1, argv);
+ MakeCallback(v8::Context::GetCurrent()->Global(), cb, 1, argv);
if (try_catch.HasCaught()) FatalException(try_catch);
delete state;
@@ -740,7 +740,7 @@ namespace zmq {
socket->Unref();
TryCatch try_catch;
- cb->Call(v8::Context::GetCurrent()->Global(), 1, argv);
+ MakeCallback(v8::Context::GetCurrent()->Global(), cb, 1, argv);
if (try_catch.HasCaught()) FatalException(try_catch);
delete state;
View
@@ -2,8 +2,6 @@
* Module dependencies.
*/
-require('set-immediate');
-
var EventEmitter = require('events').EventEmitter
, zmq = require('bindings')('zmq.node')
, util = require('util');
@@ -185,7 +183,7 @@ function Socket(type) {
EventEmitter.call(this);
this.type = type;
this._zmq = new zmq.Socket(defaultContext(), types[type]);
- this._zmq.onReady = setImmediate.bind(null, this._flush.bind(this));
+ this._zmq.onReady = this._flush.bind(this);
this._outgoing = [];
this._shouldFlush = true;
};
@@ -470,7 +468,7 @@ Socket.prototype._flush = function() {
} else {
// Allows flush to complete before handling received messages.
(function(emitArgs) {
- setImmediate(function(){
+ process.nextTick(function(){
self.emit.apply(self, emitArgs);
});
})(emitArgs);
View
@@ -8,7 +8,6 @@
"url": "http://github.com/JustinTulloss/zeromq.node.git"
},
"dependencies": {
- "set-immediate": "*",
"nan": "~0.8.0",
"bindings": "~1.1.1"
},

0 comments on commit 111b14b

Please sign in to comment.