[Pkg-javascript-commits] [node-ain2] 72/102: Revert "Fixed high-concurrency crashes due to opening too many sockets at the same time, breaking the maximum limit per process"
Jonas Smedegaard
js at moszumanska.debian.org
Tue Apr 29 11:59:51 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 08df6cab2b56e600563120cd377abf64916e4626
Author: Carlos Lage <carlos.lage at livestream.com>
Date: Mon Oct 1 18:52:53 2012 -0400
Revert "Fixed high-concurrency crashes due to opening too many sockets at the same time, breaking the maximum limit per process"
This reverts commit 8ff4312017d17c4614c0a8d3ff523d18b4b6f08f.
---
index.js | 50 +++-----------------------------------------------
1 file changed, 3 insertions(+), 47 deletions(-)
diff --git a/index.js b/index.js
index f912df5..1b1ed71 100644
--- a/index.js
+++ b/index.js
@@ -7,63 +7,19 @@ var DefaultAddress = "127.0.0.1";
var SingletonInstance = null;
- var socket
- , socketUsers = 0
- , releaseTimeout
- , socketErrorHandler = function (err) {
- if (err) {
- nodeConsole.error('socket error: ' + err)
- } else {
- nodeConsole.error('unknown socket error!')
- }
-
- if (socket !== undefined) {
- socket.close()
- socket = undefined
- socketUsers = 0
- }
- }
- , getSocket = function () {
- if (undefined === socket) {
- socket = dgram.createSocket('udp4')
- socket.on('error', socketErrorHandler)
- }
- ++socketUsers
- //console.log(socketUsers)
- return socket
- }
- , releaseSocket = function () {
- --socketUsers
- //console.log(socketUsers)
- if (0 == socketUsers && undefined === releaseTimeout) {
- releaseTimeout = setTimeout(function () {
- if (0 == socketUsers && socket !== undefined) {
- //console.log('closing socket!')
- socket.close()
- socket = undefined
- } /*else {
- console.log('another user attached while waiting to close the socket')
- }*/
- releaseTimeout = undefined
- }, 1000)
- }
- }
-
-
-
var Transport = {
UDP: function(message, severity) {
+ var client = dgram.createSocket('udp4');
var self = this;
var syslogMessage = this.composerFunction(message, severity);
-
- getSocket().send(syslogMessage,
+ client.send(syslogMessage,
0,
syslogMessage.length,
this.port,
this.address,
function(err, bytes) {
self._logError(err, bytes);
- releaseSocket();
+ client.close();
}
);
},
--
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