From f591b95e08efca8ed422341a40c40afba3164334 Mon Sep 17 00:00:00 2001 From: Bob Hansen Date: Wed, 3 Feb 2016 16:41:59 -0500 Subject: [PATCH] HDFS-9749: libhdfs++: RPC engine will attempt to close an asio socket before it's been opened. Contributed by James Clampffer --- .../src/main/native/libhdfspp/lib/rpc/rpc_connection.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h index 61d62e9c12..a8820c215b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.h @@ -282,8 +282,10 @@ void RpcConnectionImpl::Disconnect() { assert(lock_held(connection_state_lock_)); // Must be holding lock before calling request_over_the_wire_.reset(); - next_layer_.cancel(); - next_layer_.close(); + if (connected_) { + next_layer_.cancel(); + next_layer_.close(); + } connected_ = false; } }