File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1212 */
1313 public class Bundle : ObjectPool < Bundle >
1414 {
15- public MemoryStream stream = MemoryStream . createObject ( ) ;
15+ public MemoryStream stream = new MemoryStream ( ) ;
1616 public List < MemoryStream > streamList = new List < MemoryStream > ( ) ;
1717 public int numMessage = 0 ;
1818 public int messageLength = 0 ;
@@ -22,6 +22,25 @@ public class Bundle : ObjectPool<Bundle>
2222 public Bundle ( )
2323 {
2424 }
25+
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+
36+ /// <summary>
37+ /// 把自己放回缓冲池
38+ /// </summary>
39+ public void reclaimObject ( )
40+ {
41+ clear ( ) ;
42+ reclaimObject ( this ) ;
43+ }
2544
2645 public void newMessage ( Message mt )
2746 {
You can’t perform that action at this time.
0 commit comments