File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change 1212 */
1313 public class Bundle : ObjectPool < Bundle >
1414 {
15- public MemoryStream stream = new MemoryStream ( ) ;
15+ public MemoryStream stream = MemoryStream . createObject ( ) ;
1616 public List < MemoryStream > streamList = new List < MemoryStream > ( ) ;
1717 public int numMessage = 0 ;
1818 public int messageLength = 0 ;
@@ -23,22 +23,11 @@ public Bundle()
2323 {
2424 }
2525
26- public void clear ( )
27- {
28- stream = MemoryStream . createObject ( ) ;
29- streamList = new List < MemoryStream > ( ) ;
30- numMessage = 0 ;
31- messageLength = 0 ;
32- msgtype = null ;
33- _curMsgStreamIndex = 0 ;
34- }
35-
3626 /// <summary>
3727 /// 把自己放回缓冲池
3828 /// </summary>
3929 public void reclaimObject ( )
40- {
41- clear ( ) ;
30+ {
4231 reclaimObject ( this ) ;
4332 }
4433
@@ -101,8 +90,8 @@ public void send(NetworkInterface networkInterface)
10190 {
10291 for ( int i = 0 ; i < streamList . Count ; i ++ )
10392 {
104- stream = streamList [ i ] ;
105- networkInterface . send ( stream ) ;
93+ MemoryStream tempStream = streamList [ i ] ;
94+ networkInterface . send ( tempStream ) ;
10695 }
10796 }
10897 else
You can’t perform that action at this time.
0 commit comments