Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for unix domain sockets #30

Closed
tantra35 opened this issue Sep 18, 2015 · 1 comment
Closed

add support for unix domain sockets #30

tantra35 opened this issue Sep 18, 2015 · 1 comment

Comments

@tantra35
Copy link

this is very useful for local fluentd, and remote aggregators

@edsiper edsiper changed the title add support for unix doamin socket add support for unix domain sockets Sep 23, 2015
@tantra35
Copy link
Author

For myself i use follow patch:

From 17be42a38e8518d7e44698b9cc4692808b8026e0 Mon Sep 17 00:00:00 2001
From: tantra35 <ruslan.usifov@gmail.com>
Date: Fri, 18 Sep 2015 17:54:16 +0300
Subject: [PATCH] Revert "add suport for unix domain sockets"

This reverts commit ea1bc845f652b1fd04d019a1d559c9ee9ebfe368.

add suport for unix domain sockets
---
 lib/sender.js | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/lib/sender.js b/lib/sender.js
index e2b2fc6..2cad841 100644
--- a/lib/sender.js
+++ b/lib/sender.js
@@ -8,7 +8,7 @@ function FluentSender(tag, options){
   options = options || {};
   this.tag = tag;
   this.host = options.host || 'localhost';
-  this.port = options.port || 24224;
+  this.port = options.port || null;
   this.timeout = options.timeout || 3.0;
   this.verbose = this.verbose || false;
   this._timeResolution = options.milliseconds ? 1 : 1000;
@@ -41,8 +41,11 @@ FluentSender.prototype.emit = function(/*[label] <data>, [timestamp], [callback]

   self._sendQueue.push(item);
   self._sendQueueTail++;
-  self._connect(function(){
-    self._flushSendQueue();
+  self._connect(function(err){
+    if(!err)
+    {
+      self._flushSendQueue();
+    };
   });
 };

@@ -102,12 +105,23 @@ FluentSender.prototype._connect = function(callback){
       if( self._socket ){
         self._socket.destroy();
         self._socket = null;
-        self._eventEmitter.emit('error', err);
+        callback(err);
+        //self._eventEmitter.emit('error', err);
       }
     });
-    self._socket.connect(self.port, self.host, function(){
-      callback();
-    });
+
+    if(self.port)
+    {
+      self._socket.connect(self.port, self.host, function(){
+        callback();
+      });
+    }
+    else
+    {
+      self._socket.connect(self.host, function(){
+        callback();
+      });
+    }
   }else{
     if( !self._socket.writable ){
       self._socket.destroy();
-- 
1.9.5.msysgit.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants