Skip to content

Commit

Permalink
Merge 1f4f075 into 6b14177
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Sep 1, 2018
2 parents 6b14177 + 1f4f075 commit 968a9e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/src/plugins/camera/camera_service_impl.h
Expand Up @@ -459,12 +459,13 @@ class CameraServiceImpl final : public rpc::camera::CameraService::Service {

bool is_finished = false;

_camera.subscribe_status([&writer, &stream_closed_promise, &is_finished](
_camera.subscribe_status([this, &writer, &stream_closed_promise, &is_finished](
const dronecode_sdk::Camera::Status camera_status) {
rpc::camera::CameraStatusResponse rpc_camera_status_response;
auto rpc_camera_status = translateCameraStatus(camera_status);
rpc_camera_status_response.set_allocated_camera_status(rpc_camera_status.release());

std::lock_guard<std::mutex> lock(_subscribe_camera_status_mutex);
if (!writer->Write(rpc_camera_status_response) && !is_finished) {
is_finished = true;
stream_closed_promise.set_value();
Expand Down Expand Up @@ -704,6 +705,7 @@ class CameraServiceImpl final : public rpc::camera::CameraService::Service {

private:
Camera &_camera;
std::mutex _subscribe_camera_status_mutex{};
};

} // namespace backend
Expand Down

0 comments on commit 968a9e1

Please sign in to comment.