Capture port by value to prevent dangling reference.
This commit is contained in:
parent
2ee7a65253
commit
30e38527a4
@ -204,7 +204,10 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
unsigned short port = std::atoi(argv[i]);
|
unsigned short port = std::atoi(argv[i]);
|
||||||
co_spawn(io_context,
|
co_spawn(io_context,
|
||||||
[&]{ return listener(tcp::acceptor(io_context, {tcp::v4(), port})); },
|
[&io_context, port]
|
||||||
|
{
|
||||||
|
return listener(tcp::acceptor(io_context, {tcp::v4(), port}));
|
||||||
|
},
|
||||||
detached);
|
detached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user