[Bbs2ch-cvs 223] [205] b2rServerHandler が利用していないオブジェクトを持っていたので削除

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 8月 22日 (水) 20:20:58 JST


Revision: 205
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=bbs2ch&view=rev&rev=205
Author:   flyson
Date:     2007-08-22 20:20:58 +0900 (Wed, 22 Aug 2007)

Log Message:
-----------
b2rServerHandler が利用していないオブジェクトを持っていたので削除

Modified Paths:
--------------
    trunk/bbs2chreader/components/b2rServer.js

Modified: trunk/bbs2chreader/components/b2rServer.js
===================================================================
--- trunk/bbs2chreader/components/b2rServer.js	2007-08-21 18:40:56 UTC (rev 204)
+++ trunk/bbs2chreader/components/b2rServer.js	2007-08-22 11:20:58 UTC (rev 205)
@@ -120,7 +120,14 @@
   	// ********** ********* implements nsIServerSocketListener ********** **********
 
 	onSocketAccepted: function(aServerSocket, aTransport){
-		new b2rServerHandler(this, aServerSocket, aTransport);
+		const nsITransport = Components.interfaces.nsITransport;
+		aTransport.setTimeout(nsITransport.TIMEOUT_CONNECT, 30);
+		aTransport.setTimeout(nsITransport.TIMEOUT_READ_WRITE, 30);
+
+		var input = aTransport.openInputStream(nsITransport.OPEN_BLOCKING, 0, 0);
+		var output = aTransport.openOutputStream(nsITransport.OPEN_BLOCKING, 1024*16, 64);
+
+		new b2rServerHandler(aServerSocket.port, input, output);
 		// dump("b2rServer.onSocketAccepted\n");
 	},
 
@@ -250,7 +257,14 @@
   	// ********** ********* implements nsIServerSocketListener ********** **********
 
 	onSocketAccepted: function(aServerSocket, aTransport){
-		new b2rServerHandler(this, aServerSocket, aTransport);
+		const nsITransport = Components.interfaces.nsITransport;
+		aTransport.setTimeout(nsITransport.TIMEOUT_CONNECT, 30);
+		aTransport.setTimeout(nsITransport.TIMEOUT_READ_WRITE, 30);
+
+		var input = aTransport.openInputStream(nsITransport.OPEN_BLOCKING, 0, 0);
+		var output = aTransport.openOutputStream(nsITransport.OPEN_BLOCKING, 1024*16, 64);
+
+		new b2rServerHandler(aServerSocket.port, input, output);
 		// dump("b2rServer.onSocketAccepted\n");
 	},
 
@@ -309,8 +323,8 @@
 
 // ********** ********* b2rServerHandler ********** **********
 
-function b2rServerHandler(aServer, aServerSocket, aTransport){
-	this._init(aServer, aServerSocket, aTransport);
+function b2rServerHandler(aPort, aInput, aOutput){
+	this._init(aPort, aInput, aOutput);
 }
 
 
@@ -335,16 +349,13 @@
 		return this._getData;
 	},
 
-	_init: function(aServer, aServerSocket, aTransport){
-		aTransport.setTimeout(aTransport.TIMEOUT_CONNECT, 30);
-		aTransport.setTimeout(aTransport.TIMEOUT_READ_WRITE, 30);
+	_init: function(aPort, aInput, aOutput){
+		this._port = aPort;
 
-		this._server = aServer;
-		this._port = aServerSocket.port;
-		this._transport = aTransport;
+		this._input = aInput;
+		this._output = aOutput;
 
-		this._input = this._transport.openInputStream(1, 0, 0);
-		this._output = this._transport.openOutputStream(1, 1024*16, 64);
+		this._isAlive = true;
 
 		this._method = "";
 		this._httpVersion = "";
@@ -439,16 +450,17 @@
 	},
 
 	write: function(aString){
-		if(this._transport && this._transport.isAlive()){
+		if(this._isAlive){
 			var str = String(aString);
 			this._output.write(str, str.length);
 		}else if(this._scope && this._scope.script){
 			this._scope.script.cancel();
+			this._scope = null;
 		}
 	},
 
 	flush: function(aString){
-		if(this._transport && this._transport.isAlive()){
+		if(this._isAlive){
 			this._output.flush();
 		}
 	},
@@ -497,14 +509,13 @@
 	},
 
 	close: function(){
-		if(this._output && this._input){
+		if(this._isAlive){
 			this._output.close();
 			this._input.close();
+			this._output = null;
+			this._input = null;
 		}
-		this._output = null;
-		this._input = null;
-
-		this._transport = null;
+		this._isAlive = false;
 		this._scope = null;
 	},
 




bbs2ch-cvs メーリングリストの案内
Back to archive index