[ofa-general] [PATCH] opensm/osm_console_io.h: Modify osm_console_exit so only the connection is killed, not the socket

Nicolas Morey Chaisemartin nicolas.morey-chaisemartin at ext.bull.net
Fri Mar 6 01:28:38 PST 2009


With this patch, calling the exit function from a remote console doesn't kill the socket but only the connection.
This way, it will be possible to reconnect top the socket without having to restart opensm.

Signed-off-by: Nicolas Morey-Chaisemartin <nicolas.morey-chaisemartin at ext.bull.net>
---
 opensm/opensm/osm_console_io.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/opensm/opensm/osm_console_io.c b/opensm/opensm/osm_console_io.c
index ce867bd..f0cbb8d 100644
--- a/opensm/opensm/osm_console_io.c
+++ b/opensm/opensm/osm_console_io.c
@@ -210,8 +210,16 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 /* clean up and release resources */
 void osm_console_exit(osm_console_t * p_oct, osm_log_t * p_log)
 {
-	// clean up and release resources, currently just close the socket
-	osm_console_close(p_oct, p_log);
+
+	// currently just close the current connection, not the socket
+#ifdef ENABLE_OSM_CONSOLE_SOCKET
+	if ((p_oct->socket > 0) && (p_oct->in_fd != -1)) {
+		OSM_LOG(p_log, OSM_LOG_INFO,
+			"Console connection closed: %s (%s)\n",
+			p_oct->client_hn, p_oct->client_ip);
+		cio_close(p_oct);
+	}
+#endif
 }
 
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
-- 
1.6.2-rc2.GIT




More information about the general mailing list