Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix merge conflict in package.json.

  • Loading branch information...
commit 70ebd4caf8e2effdc014bd4debbbdb4dffa4da59 2 parents 924b5e0 + 5ccf342
@dhruvbird authored
View
2  README.md
@@ -244,7 +244,7 @@ if the *callback=* GET query parameter is supplied.
* [dns-srv] (https://github.com/dhruvbird/dns-srv)
* [semver] (https://github.com/isaacs/node-semver)
* [ws] (https://github.com/einaros/ws)
-* [log4js] (http://log4js.berlios.de/)
+* [node-lumberjack] (https://github.com/dhruvbird/node-lumberjack)
* [jsdom] (https://github.com/tmpvar/jsdom) for tests
* [jslint] (https://github.com/reid/node-jslint) for running lintit.sh
View
3  package.json
@@ -17,7 +17,8 @@
"dns-srv": "~0.0.6",
"semver": "~1.0.8",
"ws": "~0.4.19",
- "log4js": "~0.5.2"
+ "node-lumberjack": "= 0.0.4",
+ "ws": "= 0.4.19"
},
"devDependencies": {
"jsdom": "~0.2.15",
View
4 run-server.js
@@ -61,7 +61,7 @@ function print_boxed_message(msg) {
function main() {
var opts = require('tav').set({
logging: {
- note: "The logging level to use (default: DEBUG)",
+ note: "The logging level to use (default: INFO)",
value: -1
},
path: {
@@ -148,7 +148,7 @@ function main() {
if (opts.logging === -1) {
if (!server_options.logging) {
- server_options.logging = 'DEBUG';
+ server_options.logging = 'INFO';
}
}
else {
View
3  src/bosh-event-emitter.js
@@ -29,6 +29,9 @@ var dutil = require('./dutil.js');
var us = require('underscore');
var path = require('path');
+var filename = path.basename(path.normalize(__filename));
+var log = require('./log.js').getLogger(filename);
+
function BoshEventPipe(http_server) {
this.server = http_server;
}
View
2  src/bosh.js
@@ -38,7 +38,7 @@ var toNumber = us.toNumber;
var sprintf = dutil.sprintf;
var sprintfd = dutil.sprintfd;
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
//
View
2  src/helper.js
@@ -34,7 +34,7 @@ var path = require('path');
var toNumber = us.toNumber;
var BOSH_XMLNS = 'http://jabber.org/protocol/httpbind';
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
// Begin packet builders
View
4 src/http-server.js
@@ -31,7 +31,7 @@ var url = require('url');
var path = require('path');
var EventPipe = require('eventpipe').EventPipe;
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
var BoshRequestParser = require('./bosh-request-parser').BoshRequestParser;
@@ -124,7 +124,7 @@ function HTTPServer(port, host, stat_func, bosh_request_handler, http_error_hand
var req_body_length = 0;
var req_list_idx = -1;
- var _on_end_callback = us.once(function (err) {
+ var _on_end_callback = us.once(function _unwrapped_on_end_callback(err) {
if (err) {
log.warn("%s - destroying connection from '%s'", err, req.socket.remoteAddress);
req.destroy();
View
16 src/log.js
@@ -1,16 +1,8 @@
-var log4js = require("log4js");
+var logger = require("node-lumberjack");
-log4js.configure({
- appenders:[
- { type:"console" }
- ]
-});
-
-log4js.setGlobalLogLevel("INFO");
-
-var set_log_level = function (level) {
- log4js.setGlobalLogLevel(level);
+function set_log_level(level) {
+ logger.setGlobalLogLevel(level);
};
-module.exports = log4js;
+module.exports = logger;
module.exports.set_log_level = set_log_level;
View
2  src/lookup-service.js
@@ -29,7 +29,7 @@ var dutil = require('./dutil.js');
var events = require('events');
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
/* The XMPPLookupService tries to resolve the host name to connect to
View
2  src/main.js
@@ -33,7 +33,7 @@ var ls = require('./lookup-service.js');
var us = require('underscore');
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var logger = require('./log.js');
var log = logger.getLogger(filename);
View
2  src/response.js
@@ -29,7 +29,7 @@ var helper = require('./helper.js');
var NULL_FUNC = dutil.NULL_FUNC;
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
function Response(res, request_id, sid, options) {
View
48 src/session.js
@@ -31,7 +31,7 @@ var responsejs = require('./response.js');
var assert = require('assert').ok;
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
var toNumber = us.toNumber;
@@ -220,9 +220,9 @@ Session.prototype = {
}
// Null out all the requests for the deleted stream.
- us(this.queued_requests).each(function (queued_request, rid) {
+ us(this.queued_requests).each(function stream_request_deleter(queued_request, rid) {
if (queued_request.stream === stream) {
- log.trace("%s %s delete_stream - will not process request rid: %s", this.sid, stream.name, rid);
+ log.trace("%s %s Will not process request rid: %s", this.sid, stream.name, rid);
this.queued_requests[rid].node = $body();
this.queued_requests[rid].stream = null;
}
@@ -449,7 +449,7 @@ Session.prototype = {
var condition = 'policy-violation';
this.send_terminate_response(ro, condition);
- this.streams.forEach(function (stream) {
+ this.streams.forEach(function stream_terminator(stream) {
stream.terminate(condition);
});
@@ -458,7 +458,7 @@ Session.prototype = {
}
ro.set_socket_options(this.wait);
- ro.set_timeout(function () {
+ ro.set_timeout(function _on_request_timeout_callback() {
var pos = this.res.indexOf(ro);
if (pos === -1) {
return;
@@ -524,8 +524,8 @@ Session.prototype = {
log.trace("%s reset_inactivity_timeout - %s sec", this.sid, this.inactivity + 10);
var self = this;
- this.timeout = setTimeout(function () {
- log.info("%s terminating Session due to inactivity", self.sid);
+ this.timeout = setTimeout(function _on_session_inactivity_timeout_callback() {
+ log.info("%s Terminating Session due to inactivity", self.sid);
// Raise a no-client event on pending, unstitched as well as unacked
// responses.
var _p = us.pluck(self.pending_stitched_responses, 'response');
@@ -772,9 +772,9 @@ Session.prototype = {
// the current implementation.
//
send_pending_responses: function () {
- log.trace("%s send_pending_responses - pending.length: %s, Holding %d response objects",
+ log.trace("%s pending.length: %s, Holding %s response objects",
this.sid, this.pending_stitched_responses.length, this.res.length);
-
+
while (true) {
if (this.res.length === 0) {
// dont stitch responses as well.
@@ -839,7 +839,7 @@ Session.prototype = {
*/
enqueue_bosh_response: function (attrs, stream) {
- log.trace("%s %s enqueue_bosh_response", this.sid, stream.name);
+ log.trace("%s %s", this.sid, stream.name);
this.pending_bosh_responses[stream.name].push(attrs);
if (this._options.PIDGIN_COMPATIBLE && this.first_response) {
@@ -850,7 +850,7 @@ Session.prototype = {
},
enqueue_stanza: function (stanza, stream) {
- log.trace("%s %s enqueue_stanza", this.sid, stream.name);
+ log.trace("%s %s", this.sid, stream.name);
this.pending_stanzas[stream.name].push(stanza);
this.try_sending();
},
@@ -871,12 +871,12 @@ Session.prototype = {
// Send a response, but do NOT requeue if it fails
_send_no_requeue: function (ro, msg) {
- log.trace("%s _send_no_requeue::ro: %s", this.sid, !!ro);
+ log.trace("%s ro: %s", this.sid, !!ro);
if (us.isFalsy(ro)) {
return;
}
- log.trace("%s _send_no_requeue::ro.rid: %s, this.rid: %s", this.sid, ro.rid, this.rid);
+ log.trace("%s ro.rid: %s, this.rid: %s", this.sid, ro.rid, this.rid);
var ack = this._get_highest_rid_to_ack(ro.rid);
@@ -936,7 +936,7 @@ Session.prototype = {
*/
_get_random_stream: function () {
if (this.streams.length === 0) {
- log.error("%s get_random_stream - session has no streams", this.sid);
+ log.error("%s session has no streams", this.sid);
return null;
}
var stream = this.streams[0];
@@ -948,7 +948,7 @@ Session.prototype = {
* not in sequence.
*/
_send_immediate: function (res, response_obj) {
- log.trace("%s send_immediate - ro: %s", this.sid, !!response_obj);
+ log.trace("%s ro: %s", this.sid, !!response_obj);
var ro = new responsejs.Response(res, null, this.sid, this._options);
ro.send_response(response_obj.toString());
},
@@ -986,10 +986,10 @@ Session.prototype = {
// If the request from the client includes an ACK, we delete all
// packets with an 'rid' less than or equal to this value since
// the client has seen all those packets.
- _uar_keys.forEach(function (rid) {
+ _uar_keys.forEach(function purge_acknowledged_responses(rid) {
if (rid <= node.attrs.ack) {
// Raise the 'response-acknowledged' event.
- log.trace("%s handle_acks - received ack: %s", this.sid, rid);
+ log.trace("%s received ack: %s", this.sid, rid);
this._bep.emit('response-acknowledged',
this.unacked_responses[rid], this);
delete this.unacked_responses[rid];
@@ -1010,13 +1010,13 @@ Session.prototype = {
var _ts = this.unacked_responses[node.attrs.ack].ts;
var stream = this._get_random_stream();
if (!stream) {
- log.error("%s enqueue_report_if_reqd - couldnt get random stream", this.sid);
+ log.error("%s Couldn't get random stream", this.sid);
} else {
// We inject a response packet into the pending queue to
// notify the client that it _may_ have missed something.
// TODO: we should also have a check which ensures that
// time > RTT has passed.
- log.trace("%s enqueue_report_if_reqd - sending report - max_rid_sent: %s, node.attrs.ack: %s",
+ log.trace("%s Sending report - max_rid_sent: %s, node.attrs.ack: %s",
this.sid, this.max_rid_sent, node.attrs.ack);
this.enqueue_bosh_response({
report: node.attrs.ack + 1,
@@ -1057,7 +1057,7 @@ Session.prototype = {
// A. No idea - will need to think about it. However, a
// standard for loop seems more readable here.
//
- _queued_request_keys.forEach(function (rid) {
+ _queued_request_keys.forEach(function _handle_broken_queued_requests(rid) {
// There should be exactly 1 'rid' in state.queued_requests
// that is less than state.rid + 1. -- such requests are
// immediately returned (processed and deleted by this
@@ -1066,14 +1066,14 @@ Session.prototype = {
if (rid < self.rid + 1) {
assert(rid === node.attrs.rid);
- log.trace("%s handle_broken_connections - queued_req.rid: %s, state.rid: %s", self.sid, rid, self.rid);
+ log.trace("%s queued_req::rid: %s, state.rid: %s", self.sid, rid, self.rid);
delete self.queued_requests[rid];
is_broken = true;
if (self.unacked_responses.hasOwnProperty(rid)) {
//
// Send back the original response on this conection itself
//
- log.trace("%s handle_broken_connections - resending unacked response: %s", self.sid, rid);
+ log.trace("%s Resending unacked response: %s", self.sid, rid);
self._send_immediate(res, self.unacked_responses[rid].response);
} else if (rid >= self.rid - self.window - 2) {
//
@@ -1085,7 +1085,7 @@ Session.prototype = {
// body the second time around. The client is to be blamed for its
// stupidity and not us.
//
- log.trace("%s handle_broken_connections sending empty body for rid(out of range): %s", self.sid, rid);
+ log.trace("%s Sending empty body for rid(out of range): %s", self.sid, rid);
self._send_immediate(res, $body());
} else {
@@ -1099,7 +1099,7 @@ Session.prototype = {
//
// Note: Control DOES reach here. We need to figure out WHY.
//
- log.error("%s handle_broken_connections - terminating due to out of bound rid: %s, session.rid: %s", self.sid, rid, self.rid);
+ log.error("%s Terminating due to out of bound rid: %s, session.rid: %s", self.sid, rid, self.rid);
dutil.copy(node.attrs, { //TODO: Might be moved to helper.
type: 'terminate',
condition: 'item-not-found',
View
2  src/stream.js
@@ -51,7 +51,7 @@ function Stream(session, node, options, bep, call_on_terminate) {
}
this.__defineGetter__("state", function () { //For backward API compatibility.
- return this.session;
+ return this.session;
});
}
View
5 src/websocket.js
@@ -34,12 +34,9 @@ var assert = require('assert').ok;
var EventPipe = require('eventpipe').EventPipe;
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
-var sprintf = dutil.sprintf;
-var sprintfd = dutil.sprintfd;
-
const STREAM_UNOPENED = 1;
const STREAM_OPENED = 2;
View
9 src/xmpp-proxy-connector.js
@@ -30,12 +30,9 @@ var util = require('util');
var us = require('underscore');
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
-var sprintfd = dutil.sprintfd;
-
-
var DEFAULT_XMPP_PORT = 5222;
@@ -58,8 +55,8 @@ function XMPPProxyConnector(bosh_server, options) {
// Fired when an 'close' event is raised by the XMPP Proxy.
- this._on_xmpp_proxy_close = function(error, stream) {
- log.info("%s %s _on_xmpp_proxy_close - terminate stream", stream.session.sid, stream.name);
+ this._on_xmpp_proxy_close = function _on_xmpp_proxy_close(error, stream) {
+ log.info("%s %s - terminate stream", stream.session.sid, stream.name);
// Remove the object and notify the bosh server.
var ss = this.streams[stream.name];
if (!ss) {
View
2  src/xmpp-proxy.js
@@ -34,7 +34,7 @@ var us = require('underscore');
var XmppParser = require('./stream-parser.js').XmppStreamParser;
var path = require('path');
-var filename = "[" + path.basename(path.normalize(__filename)) + "]";
+var filename = path.basename(path.normalize(__filename));
var log = require('./log.js').getLogger(filename);
var NS_XMPP_TLS = 'urn:ietf:params:xml:ns:xmpp-tls';
Please sign in to comment.
Something went wrong with that request. Please try again.