Skip to content

Commit

Permalink
remove task.run
Browse files Browse the repository at this point in the history
  • Loading branch information
fanliang11 committed Jan 23, 2022
1 parent ededd68 commit 5ac4bac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public DefaultHttpServiceHost(Func<EndPoint, Task<IMessageListener>> messageList
_serverMessageListener = httpMessageListener;
_serverMessageListener.Received += async (sender, message) =>
{
await Task.Run(() =>
{
MessageListener.OnReceived(sender, message);
});
await MessageListener.OnReceived(sender, message);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ public HttpServiceHost(Func<EndPoint, Task<IMessageListener>> messageListenerFac
_messageListenerFactory = messageListenerFactory;
_serverMessageListener = httpMessageListener;
_serverMessageListener.Received += async (sender, message) =>
{
await Task.Run(() =>
{
MessageListener.OnReceived(sender, message);
});
{
await MessageListener.OnReceived(sender, message);
};
}

Expand Down
12 changes: 3 additions & 9 deletions src/Surging.Core/Surging.Core.Protocol.Http/HttpServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ public override async Task StartAsync(EndPoint endPoint)
return;
_serverMessageListener = await _messageListenerFactory(endPoint);
_serverMessageListener.Received += async (sender, message) =>
{
await Task.Run(() =>
{
MessageListener.OnReceived(sender, message);
});
{
await MessageListener.OnReceived(sender, message);
};
}

Expand All @@ -61,10 +58,7 @@ public override async Task StartAsync(string ip,int port)
_serverMessageListener = await _messageListenerFactory(new IPEndPoint(IPAddress.Parse(ip), AppConfig.ServerOptions.Ports.HttpPort??0));
_serverMessageListener.Received += async (sender, message) =>
{
await Task.Run(() =>
{
MessageListener.OnReceived(sender, message);
});
await MessageListener.OnReceived(sender, message);
};
}

Expand Down

0 comments on commit 5ac4bac

Please sign in to comment.