Skip to content
Browse files

Merge commit.

  • Loading branch information...
2 parents 2e7780c + b1b5c4d commit 0cd54d0d6ded948929c7de11fd3558a14b76b32e @satyamshekhar satyamshekhar committed Apr 20, 2012
Showing with 19 additions and 18 deletions.
  1. +1 −0 src/helper.js
  2. +8 −9 src/session.js
  3. +2 −1 src/stream-parser.js
  4. +2 −2 src/xmpp-proxy-connector.js
  5. +6 −6 src/xmpp-proxy.js
View
1 src/helper.js
@@ -142,6 +142,7 @@ function save_terminate_condition_for_wait_time(obj, attr, condition, wait) {
timer: setTimeout(function () {
if (obj.hasOwnProperty(attr)) {
delete obj[attr];
+ clearTimeout(obj[attr].timer);
}
}, (wait + 5) * 1000)
};
View
17 src/session.js
@@ -288,6 +288,7 @@ Session.prototype = {
// Check if this is a new stream start packet (multiple streams)
log.trace("%s: Stream Add", this.sid);
if (this.is_max_streams_violation(node)) {
+ log.info("%s %s max stream violation - will terminate", this.sid, stream_log_name);
// Make this a session terminate request.
node.attrs.type = 'terminate';
node.attrs.condition = 'policy-violation';
@@ -299,7 +300,7 @@ Session.prototype = {
// Check for stream terminate
if (helper.is_stream_terminate_request(node)) {
- log.trace("%s Stream Terminate", this.sid);
+ log.info("%s Stream Terminate Request", this.sid);
// We may be required to terminate one stream, or all
// the open streams on this BOSH session.
this.handle_client_stream_terminate_request(stream, nodes,
@@ -408,7 +409,7 @@ Session.prototype = {
// Process pending (queued) responses (if any)
// this.send_pending_responses();
} else {
- log.trace("%s broken-request - no-need-to-process - session.rid: %s", this.sid, this.rid);
+ log.info("%s broken-request - no-need-to-process - session.rid: %s", this.sid, this.rid);
should_process = false;
}
if (this.queued_requests.hasOwnProperty(node.attrs.rid)) {
@@ -444,6 +445,7 @@ Session.prototype = {
// because of the rule below.
if (this.res.length > this._options.MAX_BOSH_CONNECTIONS) {
// Just send the termination message and destroy the socket.
+ log.info("%s will terminate due to MAX_BOSH_CONNECTION exceeded", this.sid);
@dhruvbird
Owner
dhruvbird added a note Apr 20, 2012

MAX_BOSH_CONNECTION -> MAX_BOSH_CONNECTIONS ;)

@satyamshekhar
Collaborator

:P.. fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
var condition = 'policy-violation';
this.send_terminate_response(ro, condition);
@@ -484,7 +486,7 @@ Session.prototype = {
// all open streams (on the XMPP server side)
terminate: function (condition) {
if (this.streams.length !== 0) {
- log.trace("%s terminate - Terminating potentially non-empty BOSH session", this.sid);
+ log.warn("%s terminate - Terminating potentially non-empty BOSH session", this.sid);
}
// Clear out this.streams to aid GC
@@ -524,7 +526,7 @@ Session.prototype = {
var self = this;
this.timeout = setTimeout(function () {
- log.trace("%s terminating Session due to inactivity", self.sid);
+ 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');
@@ -556,7 +558,7 @@ Session.prototype = {
// These functions actually send responses to the client
send_invalid_packet_terminate_response: function (res, node) {
- log.trace("%s send_invalid_packet_terminate_response", this.sid);
+ log.info("%s send_invalid_packet_terminate_response -- will terminate", this.sid);
var attrs = {
condition : 'item-not-found',
message : 'Invalid packet'
@@ -581,7 +583,7 @@ Session.prototype = {
// send to the client as to why the session was closed.
//
send_terminate_response: function (ro, condition) {
- log.trace("%s send_terminate_response - ro: %s, condition: %s", this.sid, !!ro, condition || "no-condition");
+ log.info("%s send_terminate_response - ro: %s, condition: %s", this.sid, !!ro, condition || "no-condition");
var attrs = { };
if (condition) {
attrs.condition = condition;
@@ -794,9 +796,6 @@ Session.prototype = {
// that the client will request the missing
// RID.
this._send_no_requeue(ro, response);
-
- // We try sending more queued responses
- this.send_pending_responses();
} else {
log.trace("%s send_pending_responses - nothing to send, 0 pending - return", this.sid);
break;
View
3 src/stream-parser.js
@@ -33,7 +33,8 @@ function XmppStreamParser() {
events.EventEmitter.apply(this);
this.__defineGetter__("getCurrentByteIndex", function () {
- return this._parser.getCurrentByteIndex();
+ if (!this._parser) return 0;
+ else return this._parser.getCurrentByteIndex();
});
this._start();
View
4 src/xmpp-proxy-connector.js
@@ -59,7 +59,7 @@ 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.trace("%s %s _on_xmpp_proxy_close - terminate stream", stream.session.sid, stream.name);
+ log.info("%s %s _on_xmpp_proxy_close - terminate stream", stream.session.sid, stream.name);
// Remove the object and notify the bosh server.
var ss = this.streams[stream.name];
if (!ss) {
@@ -191,7 +191,7 @@ XMPPProxyConnector.prototype = {
return;
}
- log.trace("%s %s stream_terminate", stream.session.sid, stream.name);
+ log.info("%s %s stream_terminate", stream.session.sid, stream.name);
ss.proxy.terminate();
delete this.streams[stream.name];
}
View
12 src/xmpp-proxy.js
@@ -222,7 +222,7 @@ dutil.copy(XMPPProxy.prototype, {
terminate: function() {
if (this._is_connected) {
- log.trace("%s %s - terminating", this._void_star.session.sid, this._void_star.name);
+ log.info("%s %s - terminating", this._void_star.session.sid, this._void_star.name);
// Detach the 'data' handler so that we don't get any more events.
this._sock.removeAllListeners('data');
this._parser.end();
@@ -241,7 +241,7 @@ dutil.copy(XMPPProxy.prototype, {
this._sock.end();
}
else {
- log.trace("%s %s terminate - will terminate on connect", this._void_star.session.sid, this._void_star.name);
+ log.info("%s %s terminate - will terminate on connect", this._void_star.session.sid, this._void_star.name);
this._terminate_on_connect = true;
}
},
@@ -310,7 +310,7 @@ dutil.copy(XMPPProxy.prototype, {
},
_on_stream_end: function(attr) {
- log.trace("%s %s _on_stream_end: stream terminated", this._void_star.session.sid, this._void_star.name);
+ log.info("%s %s _on_stream_end: stream terminated", this._void_star.session.sid, this._void_star.name);
this.terminate();
},
@@ -320,18 +320,18 @@ dutil.copy(XMPPProxy.prototype, {
},
_close_connection: function(error) {
- log.trace("%s %s _close_connection error: %s", this._void_star.session.sid, this._void_star.name, error);
+ log.info("%s %s _close_connection error: %s", this._void_star.session.sid, this._void_star.name, error);
this.emit('close', error, this._void_star);
},
_on_close: function(had_error) {
had_error = had_error || false;
- log.trace("%s %s _on_close error: %s", this._void_star.session.sid, this._void_star.name, !!had_error);
+ log.info("%s %s _on_close error: %s", this._void_star.session.sid, this._void_star.name, !!had_error);
this._close_connection(had_error ? 'remote-connection-failed' : null);
},
_on_lookup_error: function(error) {
- log.warn("%s %s _on_lookup_error - %s", this._void_star.session.sid, this._void_star.name, error);
+ log.info("%s %s _on_lookup_error - %s", this._void_star.session.sid, this._void_star.name, error);
this._close_connection(error);
}
});

0 comments on commit 0cd54d0

Please sign in to comment.
Something went wrong with that request. Please try again.