Repository: hadoop Updated Branches: refs/heads/HDFS-8707 ea310d753 -> 6828dd500
HDFS-9265. InputStreamImpl should hold a shared_ptr of the BlockReader. Contributed by James Clampffer. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6828dd50 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6828dd50 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6828dd50 Branch: refs/heads/HDFS-8707 Commit: 6828dd500196cb737ec78947457110ac9da097c5 Parents: ea310d7 Author: Haohui Mai <[email protected]> Authored: Wed Oct 21 11:49:02 2015 -0700 Committer: Haohui Mai <[email protected]> Committed: Wed Oct 21 11:49:02 2015 -0700 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/lib/fs/inputstream_impl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/6828dd50/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/inputstream_impl.h ---------------------------------------------------------------------- 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 2044f3f..0d3b302 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<asio::ip::tcp::socket> Reader; struct State { std::unique_ptr<asio::ip::tcp::socket> conn_; - std::unique_ptr<Reader> reader_; + std::shared_ptr<Reader> reader_; std::array<asio::ip::tcp::endpoint, 1> endpoints_; size_t transferred_; Reader *reader() { return reader_.get(); } @@ -47,7 +47,7 @@ struct InputStreamImpl::RemoteBlockReaderTrait { auto m = continuation::Pipeline<State>::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<Reader>(BlockReaderOptions(), s.conn_.get()); auto datanode = dn.id(); s.endpoints_[0] = tcp::endpoint(address::from_string(datanode.ipaddr()), datanode.xferport());
