1
1

correct mca_oob_tcp_ping to cleanup correctly in the case of a timeout

This commit was SVN r2718.
Этот коммит содержится в:
Tim Woodall 2004-09-16 14:12:22 +00:00
родитель 46f755c016
Коммит c32cb44a37
3 изменённых файлов: 31 добавлений и 5 удалений

Просмотреть файл

@ -652,7 +652,6 @@ static void mca_oob_tcp_peer_send_handler(int sd, short flags, void* user)
/* complete the current send */
mca_oob_tcp_msg_t* msg = peer->peer_send_msg;
ompi_list_item_t item1 = *(ompi_list_item_t*)peer;
if(mca_oob_tcp_msg_send_handler(msg, peer)) {
mca_oob_tcp_msg_complete(msg, &peer->peer_name);
} else {
@ -804,4 +803,28 @@ static void mca_oob_tcp_peer_timer_handler(int sd, short flags, void* user)
OMPI_THREAD_UNLOCK(&peer->peer_lock);
}
/*
* Remove any references to the indicated message.
*/
void mca_oob_tcp_peer_dequeue_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_msg_t* msg)
{
ompi_list_item_t* item;
OMPI_THREAD_LOCK(&peer->peer_lock);
if (peer->peer_send_msg == msg)
peer->peer_send_msg = NULL;
if (peer->peer_recv_msg == msg)
peer->peer_recv_msg = NULL;
for( item = ompi_list_get_first(&peer->peer_send_queue);
item != ompi_list_get_end(&peer->peer_send_queue);
item != ompi_list_get_next(item)) {
if(item == (ompi_list_item_t*)msg) {
ompi_list_remove_item(&peer->peer_send_queue, item);
break;
}
}
OMPI_THREAD_UNLOCK(&peer->peer_lock);
}

Просмотреть файл

@ -131,6 +131,11 @@ void mca_oob_tcp_peer_resolved(mca_oob_tcp_peer_t* peer, mca_oob_tcp_addr_t* add
*/
int mca_oob_tcp_peer_send_ident(mca_oob_tcp_peer_t* peer);
/*
* Remove any references to the message from the peers send/recv queue.
*/
void mca_oob_tcp_peer_dequeue_msg(mca_oob_tcp_peer_t* peer, mca_oob_tcp_msg_t* msg);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

Просмотреть файл

@ -15,7 +15,6 @@ int mca_oob_tcp_ping(
const ompi_process_name_t* name,
const struct timeval *timeout)
{
#if 0
mca_oob_tcp_peer_t* peer = mca_oob_tcp_peer_lookup(name);
mca_oob_tcp_msg_t* msg;
struct timeval tv;
@ -78,10 +77,9 @@ int mca_oob_tcp_ping(
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = (tv.tv_usec * 1000);
rc = mca_oob_tcp_msg_timedwait(msg, NULL, &ts);
if(rc != OMPI_SUCCESS)
mca_oob_tcp_peer_dequeue_msg(peer,msg);
MCA_OOB_TCP_MSG_RETURN(msg);
return rc;
#else
return OMPI_SUCCESS;
#endif
}