diff --git a/gloo/transport/uv/device.cc b/gloo/transport/uv/device.cc index 1dc986433..78d37e222 100644 --- a/gloo/transport/uv/device.cc +++ b/gloo/transport/uv/device.cc @@ -304,7 +304,7 @@ void Device::connectAsListener( const Address& local, std::chrono::milliseconds timeout, ConnectCallback connectCallback) { - defer([=] { + defer([=, this] { decltype(pendingConnections_)::mapped_type pendingConnection; // Find pending connection, or stash the connect callback. @@ -360,7 +360,7 @@ void Device::connectAsInitiator( const Address& remote, std::chrono::milliseconds timeout, ConnectCallback fn) { - defer([=] { + defer([=, this] { auto tcp = loop_->resource(); auto timer = loop_->resource(); @@ -458,7 +458,7 @@ void Device::listenCallback() { // Wait for remote side to write sequence number. handle->once( - [=](const libuv::ReadEvent& event, libuv::TCP& handle) { + [=, this](const libuv::ReadEvent& event, libuv::TCP& handle) { // Sequence number has been read. Either there is an existing // connection callback for this sequence number, or we'll hold // on to the handle while we wait for the pair to pass a diff --git a/gloo/transport/uv/pair.cc b/gloo/transport/uv/pair.cc index 4db8bf32c..f40533775 100644 --- a/gloo/transport/uv/pair.cc +++ b/gloo/transport/uv/pair.cc @@ -554,7 +554,7 @@ void Pair::closeWhileHoldingPairLock() { state_, CONNECTING, "Cannot close pair while waiting on connection"); break; case CONNECTED: - device_->defer([=] { this->handle_->close(); }); + device_->defer([=, this] { this->handle_->close(); }); state_ = CLOSING; break; case CLOSING: