0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00

Make lambda functions mutable that benefit from using std::move() on closure vars

Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
James Yonan 2018-05-11 21:40:57 -06:00 committed by Lev Stipakov
parent 35c0480180
commit fd1ed92b68
No known key found for this signature in database
GPG Key ID: 88670BE258B9C258

View File

@ -820,10 +820,10 @@ namespace openvpn {
AsioPolySock::TCP* s = new AsioPolySock::TCP(io_context, 0);
AsioPolySock::Base::Ptr sock(s);
s->socket.async_connect(ep,
[self=Ptr(this), sock](const openvpn_io::error_code& error)
[self=Ptr(this), sock](const openvpn_io::error_code& error) mutable
{
// this is a connect, but we reuse the accept method
self->handle_accept(sock, error);
self->handle_accept(std::move(sock), error);
});
}
@ -834,10 +834,10 @@ namespace openvpn {
AsioPolySock::Unix* s = new AsioPolySock::Unix(io_context, 0);
AsioPolySock::Base::Ptr sock(s);
s->socket.async_connect(ep,
[self=Ptr(this), sock](const openvpn_io::error_code& error)
[self=Ptr(this), sock](const openvpn_io::error_code& error) mutable
{
// this is a connect, but we reuse the accept method
self->handle_accept(sock, error);
self->handle_accept(std::move(sock), error);
});
#else
throw Exception("unix sockets not supported on this platform");