Skip to content

Commit 24daeda

Browse files
authored
update(touchsocket):version to 4.0.0-rc42 (#10265)
* update(touchsocket):version to 4.0.0-rc.2 * update(touchsocket):version to 4.0.0-rc.5 * optimize(touchsocket):scheduler * Performance (TouchSocketHttp, TouchSocketWebApi): Enable server garbage collection * update(touchsocket):version to 4.0.0-rc.15 * update(touchsocket):version to 4.0.0-rc42 * 重构(Program): 显式指定变量类型并优化配置 显式指定变量类型以提高代码可读性和类型安全性 修改命名空间为 `TouchSocketHttp` 将 `options.BufferOnDemand` 默认值从 `false` 修改为 `true` 调整 `SetTransportOption` 和 `ApiServer` 中的相关代码 * 优化(csproj): 升级TouchSocket包版本 在TouchSocketHttp.csproj和TouchSocketWebApi.csproj中,将TouchSocket.Hosting和TouchSocket.WebApi的包引用版本从4.0.0-rc.42升级到4.0.0-rc.44,以修复错误、提高性能或增加新功能
1 parent 45329a5 commit 24daeda

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

frameworks/CSharp/touchsocket/src/TouchSocketHttp/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ public class Program
1010
{
1111
private static async Task Main(string[] args)
1212
{
13-
var port = 8080;
13+
int port = 8080;
1414
var service = new MyHttpService();
1515

1616
await service.SetupAsync(new TouchSocketConfig()
1717
.SetListenIPHosts(port)
1818
.SetMaxCount(1000000)
19+
.SetTransportOption(options =>
20+
{
21+
options.BufferOnDemand = true;
22+
})
1923
.ConfigureContainer(a =>
2024
{
2125
a.AddConsoleLogger();

frameworks/CSharp/touchsocket/src/TouchSocketHttp/TouchSocketHttp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
14-
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.15" />
15-
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.15" />
14+
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.44" />
15+
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.44" />
1616
</ItemGroup>
1717
</Project>
1818

frameworks/CSharp/touchsocket/src/TouchSocketWebApi/Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public static void Main(string[] args)
1919
{
2020
config.SetListenIPHosts(8080)
2121
.SetMaxCount(1000000)
22+
.SetTransportOption(options =>
23+
{
24+
options.BufferOnDemand = true;
25+
})
2226
.ConfigureContainer(a =>
2327
{
2428
a.AddConsoleLogger();
@@ -45,7 +49,7 @@ public static void Main(string[] args)
4549
});
4650
});
4751

48-
var host = builder.Build();
52+
IHost host = builder.Build();
4953
host.Run();
5054
}
5155
}
@@ -60,7 +64,7 @@ public partial class ApiServer : SingletonRpcServer
6064
[WebApi(Method = HttpMethodType.Get)]
6165
public async Task Plaintext(IWebApiCallContext callContext)
6266
{
63-
var response = callContext.HttpContext.Response;
67+
HttpResponse response = callContext.HttpContext.Response;
6468
response.SetStatus(200, "ok");
6569
response.Content = m_contentPlaintext;
6670
await response.AnswerAsync().ConfigureAwait(false);

frameworks/CSharp/touchsocket/src/TouchSocketWebApi/TouchSocketWebApi.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
13-
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.15" />
14-
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.15" />
13+
<PackageReference Include="TouchSocket.Hosting" Version="4.0.0-rc.44" />
14+
<PackageReference Include="TouchSocket.WebApi" Version="4.0.0-rc.44" />
1515
</ItemGroup>
1616
</Project>

0 commit comments

Comments
 (0)