From 170734182b8861e812c9179bf76e5fbaa62a7e89 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 4 Apr 2016 16:02:05 +0900 Subject: [PATCH 1/2] oob/usock: mca_oob_usock_peer_close() sets peer->sd = -1 after close() so usock_peer_create_socket know it must re-create the socket /* assuming it is ever supposed to occur */ also fix a typo (peer->sd >= 0) in usock_peer_create_socket --- orte/mca/oob/usock/oob_usock_connection.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/orte/mca/oob/usock/oob_usock_connection.c b/orte/mca/oob/usock/oob_usock_connection.c index 48229b80fcc..ea3e113121a 100644 --- a/orte/mca/oob/usock/oob_usock_connection.c +++ b/orte/mca/oob/usock/oob_usock_connection.c @@ -14,7 +14,7 @@ * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2015 Intel, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -85,7 +85,7 @@ static int usock_peer_create_socket(mca_oob_usock_peer_t* peer) { int flags; - if (peer->sd > 0) { + if (peer->sd >=0) { return ORTE_SUCCESS; } @@ -771,6 +771,7 @@ void mca_oob_usock_peer_close(mca_oob_usock_peer_t *peer) /* release the socket */ close(peer->sd); + peer->sd = -1; /* inform the component-level that we have lost a connection so * it can decide what to do about it. From d757fbba5d83b8aa409d070d33129531ed72148b Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 4 Apr 2016 16:04:54 +0900 Subject: [PATCH 2/2] oob/usock: drop message to be sent in process_send() --- orte/mca/oob/usock/oob_usock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/orte/mca/oob/usock/oob_usock.c b/orte/mca/oob/usock/oob_usock.c index 2f88abda0ff..9992e62a97b 100644 --- a/orte/mca/oob/usock/oob_usock.c +++ b/orte/mca/oob/usock/oob_usock.c @@ -316,6 +316,10 @@ static void process_send(int fd, short args, void *cbdata) goto cleanup; } + if (MCA_OOB_USOCK_CLOSED == peer->state) { + /* the peer has gone, it will never come back */ + goto cleanup; + } /* add the message to the queue for sending after the * connection is formed */