File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/BootstrapBlazor/Services/TcpSocket/DataPackage Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ public override async Task ReceiveAsync(Memory<byte> data)
3535 var segment = data . Length > len ? data [ ..len ] : data ;
3636 segment . CopyTo ( _data [ _receivedLength ..] ) ;
3737
38+ // 更新数据
39+ data = data [ segment . Length ..] ;
40+
3841 // 更新已接收长度
3942 _receivedLength += segment . Length ;
4043
@@ -47,19 +50,13 @@ public override async Task ReceiveAsync(Memory<byte> data)
4750 {
4851 await ReceivedCallBack ( _data ) ;
4952 }
50- }
51-
52- // 检查剩余长度是否大于总长度
53- if ( data . Length >= segment . Length + length )
54- {
55- data = data [ segment . Length ..] ;
5653 continue ;
5754 }
5855
5956 // 缓存剩余数据
60- if ( data . Length > len )
57+ if ( data . Length > 0 )
6158 {
62- SlicePackage ( data , data . Length - len ) ;
59+ SlicePackage ( data , data . Length ) ;
6360 }
6461 break ;
6562 }
You can’t perform that action at this time.
0 commit comments