diff --git a/sql-common/client.c b/sql-common/client.c
index 68878df50e848a606cbd1a583300ff9c529277c1..1941e6bc51778a5c91fa70dd6abe0626678a5a9a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -133,6 +133,7 @@ static void mysql_close_free(MYSQL *mysql);
 static int wait_for_data(my_socket fd, uint timeout);
 #endif
 
+
 /****************************************************************************
   A modified version of connect().  my_connect() allows you to specify
   a timeout value, in seconds, that we should wait until we
diff --git a/sql/slave.cc b/sql/slave.cc
index 7fb7fbdade49cd4d5ce33be7ce54f9c296ba2c57..cb37a7980376b4e2b16d9b44f5c90f019f9e001c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3056,6 +3056,9 @@ dump");
       }
 	  
       thd->proc_info= "Waiting to reconnect after a failed binlog dump request";
+#ifdef SIGNAL_WITH_VIO_CLOSE
+      thd->clear_active_vio();
+#endif
       end_server(mysql);
       /*
 	First time retry immediately, assuming that we can recover
@@ -3129,6 +3132,9 @@ max_allowed_packet",
 	  goto err;
 	}
 	thd->proc_info = "Waiting to reconnect after a failed master event read";
+#ifdef SIGNAL_WITH_VIO_CLOSE
+        thd->clear_active_vio();
+#endif
 	end_server(mysql);
 	if (retry_count++)
 	{
@@ -4383,4 +4389,5 @@ template class I_List_iterator<i_string>;
 template class I_List_iterator<i_string_pair>;
 #endif
 
+
 #endif /* HAVE_REPLICATION */