Skip to content

Commit

Permalink
[src] Fix the bug of pass a shared_ptr by value to a lambda in RpcSer…
Browse files Browse the repository at this point in the history
…ver::OnConnectionCallback()
  • Loading branch information
Sigma711 committed Aug 29, 2023
1 parent 5653a96 commit cba3db6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ void RpcServer::OnConnectionCallback(Connecting& connection) {
std::shared_ptr<RpcAsyncChannel> rpc_channel =
std::make_shared<RpcAsyncChannel>(connection);
rpc_channel->SetServices(&services_);
connection.RegisterOnMessageCallback(
[&rpc_channel](Connecting& connection, IoBuffer* io_buffer,
TimePoint receive_time) {
rpc_channel->OnMessage(connection, io_buffer, receive_time);
});
connection.RegisterOnMessageCallback([rpc_channel](Connecting& connection,
IoBuffer* io_buffer,
TimePoint receive_time) {
rpc_channel->OnMessage(connection, io_buffer, receive_time);
});
connection.SetContext<std::shared_ptr<RpcAsyncChannel>>(rpc_channel);
} else {
connection.SetContext<std::shared_ptr<RpcAsyncChannel>>(
Expand Down

0 comments on commit cba3db6

Please sign in to comment.