Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dhruvbird/node-xmpp-bosh
Browse files Browse the repository at this point in the history
  • Loading branch information
satyamshekhar committed Feb 18, 2012
2 parents 0caf940 + 45e7bef commit 05e5832
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
8 changes: 5 additions & 3 deletions src/bosh.js
Expand Up @@ -153,19 +153,21 @@ exports.createServer = function (options) {
} else {
session = session_store.get_session(node);
if (!session) { //No (valid) session ID in BOSH request. Not phare enuph.
log.info("Invalid Session: %s", node.attrs.sid || "No Session Id");
log.debug("%s Invalid Session", node.attrs.sid || "No_Session_ID");
session_store.send_invalid_session_terminate_response(res, node);
return;
}
try {
// This is enclosed in a try/catch block since invalid requests
// at this point MAY not have these attributes
log.debug("%s %s req.rid: %s, session.rid: %s", session.sid, node.attrs.stream || "NO Stream", node.attrs.rid, session.rid);
log.debug("%s %s req.rid: %s, session.rid: %s", session.sid,
node.attrs.stream || "NO_Stream", node.attrs.rid,
session.rid);
} catch (ex) { }

// Check the validity of the packet and the BOSH session
if (!session.is_valid_packet(node)) {
log.info("%s Invalid Packet", session.sid);
log.debug("%s Invalid Packet", session.sid);
session.send_invalid_packet_terminate_response(res, node);
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/http-server.js
Expand Up @@ -64,7 +64,6 @@ function HTTPServer(port, host, stat_func, bosh_request_handler, http_error_hand
log.warn("Timed out - destroying connection from '%s'", req.socket.remoteAddress);
req.destroy();
} else {
log.info("RECD: %s", data);
bosh_request_handler(res, data);
clearTimeout(end_timeout);
}
Expand Down
2 changes: 1 addition & 1 deletion src/response.js
Expand Up @@ -71,7 +71,7 @@ Response.prototype = {
this._res.setHeader("Content-Length", Buffer.byteLength(msg, 'utf8'));
this._res.writeHead(200, this._options.HTTP_POST_RESPONSE_HEADERS);
this._res.end(msg);
log.info("SENT: %s", msg);
log.debug("SENT: %s", msg);
},

// If a client closes a connection and a response to that HTTP request
Expand Down
9 changes: 5 additions & 4 deletions src/session.js
Expand Up @@ -979,10 +979,11 @@ Session.prototype = {

//We are fairly generous
if (_uar_keys.length > this._options.WINDOW_SIZE * 4) {
// The client seems to be buggy. It has not ACKed the
// last WINDOW_SIZE * 4 requests. We turn off ACKs.
// The client seems to be buggy. It has not ACKed the last
// WINDOW_SIZE * 4 requests. We turn off ACKs.
delete this.ack;
log.info("%s handle_acks - disabling ACKs", this.sid);
log.debug("%s handle_acks - disabling ACKs", this.sid);

// will not emit response-acknowledged for these
// responses. consider them to be lost.
while (_uar_keys.length > this.window) {
Expand All @@ -1005,7 +1006,7 @@ Session.prototype = {
_uar_keys.forEach(function (rid) {
if (rid <= node.attrs.ack) {
// Raise the 'response-acknowledged' event.
log.info("%s handle_acks - received ack: %s", self.sid, rid);
log.debug("%s handle_acks - received ack: %s", self.sid, rid);
self._bep.emit('response-acknowledged',
self.unacked_responses[rid], self);
delete self.unacked_responses[rid];
Expand Down
8 changes: 4 additions & 4 deletions src/xmpp-proxy.js
Expand Up @@ -146,7 +146,7 @@ dutil.copy(XMPPProxy.prototype, {
},

_on_stanza: function(stanza) {
log.info("%s %s _on_stanza parsed: %s", this._void_star.session.sid, this._void_star.name, stanza);
log.debug("%s %s _on_stanza parsed: %s", this._void_star.session.sid, this._void_star.name, stanza);

dutil.extend(stanza.attrs, this._stream_attrs);

Expand Down Expand Up @@ -236,7 +236,7 @@ dutil.copy(XMPPProxy.prototype, {
if (this._is_connected) {
try {
this._sock.write(data);
log.info("%s %s Sent: %s", this._void_star.session.sid, this._void_star.name, data);
log.debug("%s %s Sent: %s", this._void_star.session.sid, this._void_star.name, data);
}
catch (ex) {
this._is_connected = false;
Expand Down Expand Up @@ -268,7 +268,7 @@ dutil.copy(XMPPProxy.prototype, {
_on_data: function(d) {
var d = d.toString();

log.info("%s %s _on_data RECD: %s", this._void_star.session.sid, this._void_star.name, d);
log.debug("%s %s _on_data RECD: %s", this._void_star.session.sid, this._void_star.name, d);

this._parser.parse(d);
},
Expand All @@ -290,7 +290,7 @@ dutil.copy(XMPPProxy.prototype, {
},

_on_stream_error: function(error) {
log.error("%s %s _on_stream_error - will terminate: %s", this._void_star.session.sid, this._void_star.name);
log.error("%s %s _on_stream_error - will terminate: %s", this._void_star.session.sid, this._void_star.name, error);
this.terminate();
},

Expand Down

0 comments on commit 05e5832

Please sign in to comment.