From: phasefx Date: Fri, 18 Mar 2005 05:46:33 +0000 (+0000) Subject: Some bugfixes from Bill X-Git-Tag: osrf_rel_2_0_1~1626 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=56f2c265c8aacb6f6155fd1094b28f8f9beb0fb3;p=OpenSRF.git Some bugfixes from Bill git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@246 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/javascript/opensrf_jabber_transport.js b/src/javascript/opensrf_jabber_transport.js index fbd6dac..72e0b5d 100644 --- a/src/javascript/opensrf_jabber_transport.js +++ b/src/javascript/opensrf_jabber_transport.js @@ -288,8 +288,18 @@ jabber_socket.prototype.tcp_recv = function( timeout ) { did_receive = true; while( count > 0 ) { + new Logger().transport( + "before process data", Logger.DEBUG ); + this.process_data( this.instream.read( count ) ); + + new Logger().transport( + "after process data", Logger.DEBUG ); + count = this.instream.available(); + + new Logger().transport( + "received " + count + " bytes" , Logger.DEBUG ); } } else { @@ -345,19 +355,24 @@ jabber_socket.prototype.recv = function( timeout ) { now = new Date().getTime(); then = now; + var first_pass = true; while( ((now-then) <= timeout) ) { - if( this.buffer.length == 0 ) { + if( this.buffer.length == 0 || !first_pass ) { if( ! this.tcp_recv( timeout ) ) { return null; } } + first_pass = false; //new Logger().transport( "\n\nTCP Buffer Before: \n" + this.buffer, Logger.DEBUG ); var buf = this.buffer; this.buffer = ""; + new Logger().transport( "CURRENT BUFFER\n" + buf, + Logger.DEBUG ); + buf = buf.replace( /\n/g, '' ); // remove pesky newlines var reg = /.*?<\/message>/; @@ -387,9 +402,11 @@ jabber_socket.prototype.recv = function( timeout ) { process_iq_data( msg_xml ); return; + } else { + this.buffer = buf; } - } + } now = new Date().getTime(); }