Skip to content

Commit

Permalink
升级IPacket.Slice,明确是否要转移控制权
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 13, 2024
1 parent 77dfd1f commit 22bd75d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions NewLife.Remoting/Http/HttpMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public virtual Boolean Read(IPacket pk)
var p = pk.GetSpan().IndexOf(NewLine);
if (p < 0) return false;

Header = pk.Slice(0, p);
Payload = pk.Slice(p + 4);
Header = pk.Slice(0, p, false);
Payload = pk.Slice(p + 4, -1, false);

return true;
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public virtual IPacket ToPacket()
if (Header == null) throw new ArgumentNullException(nameof(Header));

// 使用子数据区,不改变原来的头部对象
var pk = Header.Slice(0, -1);
var pk = Header.Slice(0, -1, false);
pk.Append(NewLine);
//pk.Next = new[] { (Byte)'\r', (Byte)'\n' };

Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/IEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public virtual IPacket Encode(String action, Int32? code, IPacket? value)
// 参数或结果。长度部分定长4字节
if (value != null) writer.Write(value.Total);

var pk2 = pk.Slice(8, writer.Position - 8);
var pk2 = pk.Slice(8, writer.Position - 8, true);
if (value != null) pk2.Next = value;

return pk2;
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Remoting/NewLife.Remoting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="11.0.2024.1011-beta1533" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.1013-beta0746" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Samples/IoTZero/IoTZero.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Cube.Core" Version="6.1.2024.1005" />
<PackageReference Include="NewLife.Cube.Core" Version="6.1.2024.1013-beta0604" />
<PackageReference Include="NewLife.IoT" Version="2.2.2024.1004-beta0943" />
<PackageReference Include="NewLife.MQTT" Version="2.0.2024.1011-beta1037" />
<PackageReference Include="NewLife.MQTT" Version="2.0.2024.1013-beta0757" />
<PackageReference Include="NewLife.Redis" Version="6.0.2024.1009-beta0730" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.1.2024.1007-beta1552" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.1.2024.1012-beta1536" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.1005" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Samples/Zero.RpcServer/Zero.RpcServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<ItemGroup>
<PackageReference Include="NewLife.Redis" Version="6.0.2024.1009-beta0730" />
<PackageReference Include="NewLife.Stardust" Version="3.1.2024.1007-beta1552" />
<PackageReference Include="NewLife.Stardust" Version="3.1.2024.1012-beta1536" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.1005" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Samples/ZeroServer/ZeroServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Cube.Core" Version="6.1.2024.1005" />
<PackageReference Include="NewLife.Cube.Core" Version="6.1.2024.1013-beta0604" />
<PackageReference Include="NewLife.Redis" Version="6.0.2024.1009-beta0730" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.1.2024.1007-beta1552" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="3.1.2024.1012-beta1536" />
<PackageReference Include="NewLife.XCode" Version="11.16.2024.1005" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="11.0.2024.1011-beta1533" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.1013-beta0746" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion XUnitTest/XUnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.1011-beta1533" />
<PackageReference Include="NewLife.Core" Version="11.0.2024.1013-beta0746" />
<PackageReference Include="NewLife.UnitTest" Version="1.0.2024.1006" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 22bd75d

Please sign in to comment.