[Pkg-javascript-commits] [node-ain2] 46/102: close socket in callback

Jonas Smedegaard js at moszumanska.debian.org
Tue Apr 29 11:59:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-ain2.

commit 9dfafd4ac59f7af33ac4083f6e21c8f54f539bdc
Author: SHIDARA Yoji <dara at shidara.net>
Date:   Thu Nov 10 18:41:58 2011 +0900

    close socket in callback
    
    this will fix problem with node v0.6.0
---
 index.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 5f62431..122e36b 100644
--- a/index.js
+++ b/index.js
@@ -36,6 +36,7 @@ function getDate() {
 var Transport = {
     UDP: function(message, severity) {
         var client = dgram.createSocket('udp4');
+        var self = this;
 
         message = new Buffer('<' + (this.facility * 8 + severity) + '>' +
             getDate() + ' ' + this.hostname + ' ' + 
@@ -46,9 +47,11 @@ var Transport = {
                     message.length,
                     this.port,
                     this.address,
-                    this._logError
+                    function(err, bytes) {
+                      self._logError(err, bytes);
+                      client.close();
+                    }
         );
-        client.close();
     },
 
     file: (function() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ain2.git



More information about the Pkg-javascript-commits mailing list