File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -971,6 +971,8 @@ KBEngine.Bundle = function()
971971 this . writeMsgLength ( this . messageLength ) ;
972972 if ( this . stream )
973973 this . memorystreams . push ( this . stream ) ;
974+
975+ this . stream = KBEngine . MemoryStream . createObject ( ) ;
974976 }
975977
976978 if ( issend )
@@ -990,12 +992,8 @@ KBEngine.Bundle = function()
990992 {
991993 var tmpStream = this . memorystreams [ i ] ;
992994 network . send ( tmpStream . getbuffer ( ) ) ;
993- tmpStream . reclaimObject ( ) ;
994995 }
995996
996- this . memorystreams = new Array ( ) ;
997- this . stream = KBEngine . MemoryStream . createObject ( ) ;
998-
999997 this . reclaimObject ( ) ;
1000998 }
1001999
@@ -1086,7 +1084,18 @@ KBEngine.Bundle = function()
10861084
10871085 this . clear = function ( )
10881086 {
1089- this . stream = KBEngine . MemoryStream . createObject ( ) ;
1087+ for ( var i = 0 ; i < this . memorystreams . length ; i ++ )
1088+ {
1089+ if ( this . stream != this . memorystreams [ i ] )
1090+ this . memorystreams [ i ] . reclaimObject ( ) ;
1091+ }
1092+
1093+
1094+ if ( this . stream )
1095+ this . stream . clear ( ) ;
1096+ else
1097+ this . stream = KBEngine . MemoryStream . createObject ( ) ;
1098+
10901099 this . memorystreams = new Array ( ) ;
10911100 this . numMessage = 0 ;
10921101 this . messageLengthBuffer = null ;
You can’t perform that action at this time.
0 commit comments