xmpp.js: Set connection timeout to 0 to disable it (thanks pkrumins) default tip

Fri, 16 Apr 2010 23:05:06 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 16 Apr 2010 23:05:06 +0100
changeset 19
998b0659c5f7
parent 18
06abd01c13cb

xmpp.js: Set connection timeout to 0 to disable it (thanks pkrumins)

xmpp.js file | annotate | diff | comparison | revisions
--- a/xmpp.js	Mon Mar 01 15:52:39 2010 +0000
+++ b/xmpp.js	Fri Apr 16 23:05:06 2010 +0100
@@ -136,10 +136,12 @@
 		
 		var conn = this;
 
-        // Note that tcp.createConnection also initiates the connection.
-        // This doesn't appear to create problems with adding listeners
-        // afterward, but should be kept in mind should any arise.
-        this.socket = tcp.createConnection(this.port, this.host)
+        	// Note that tcp.createConnection also initiates the connection.
+        	// This doesn't appear to create problems with adding listeners
+        	// afterward, but should be kept in mind should any arise.
+        	this.socket = tcp.createConnection(this.port, this.host)
+        
+        	this.socket.setTimeout(0); // Because Node's default timeout is 60s
 
 		this.socket.addListener("connect", recontext(this, conn._socket_connected));
 		this.socket.addListener("disconnect", recontext(this, conn._socket_disconnected));

mercurial