diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h index 2044f3f5799..0d3b3027bb8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h @@ -33,7 +33,7 @@ struct InputStreamImpl::RemoteBlockReaderTrait { typedef RemoteBlockReader Reader; struct State { std::unique_ptr conn_; - std::unique_ptr reader_; + std::shared_ptr reader_; std::array endpoints_; size_t transferred_; Reader *reader() { return reader_.get(); } @@ -47,7 +47,7 @@ struct InputStreamImpl::RemoteBlockReaderTrait { auto m = continuation::Pipeline::Create(); auto &s = m->state(); s.conn_.reset(new tcp::socket(*io_service)); - s.reader_.reset(new Reader(BlockReaderOptions(), s.conn_.get())); + s.reader_ = std::make_shared(BlockReaderOptions(), s.conn_.get()); auto datanode = dn.id(); s.endpoints_[0] = tcp::endpoint(address::from_string(datanode.ipaddr()), datanode.xferport());