Skip to content

Commit 184ccc8

Browse files
author
Ralph Castain
committed
Cleanup some code so it is clear that it is executing in an event. Ensure that peer event base is properly set on incoming connections
Signed-off-by: Ralph Castain <[email protected]>
1 parent 4e06b96 commit 184ccc8

File tree

3 files changed

+52
-54
lines changed

3 files changed

+52
-54
lines changed

orte/mca/oob/tcp/oob_tcp_connection.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ static void tcp_peer_event_init(mca_oob_tcp_peer_t* peer)
501501
{
502502
if (peer->sd >= 0) {
503503
assert(!peer->send_ev_active && !peer->recv_ev_active);
504+
if (NULL == peer->ev_base) {
505+
ORTE_OOB_TCP_NEXT_BASE(peer);
506+
}
504507
opal_event_set(peer->ev_base,
505508
&peer->recv_event,
506509
peer->sd,

orte/mca/rml/base/base.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
@@ -259,7 +259,6 @@ OBJ_CLASS_DECLARATION(orte_self_send_xfer_t);
259259
/* common implementations */
260260
ORTE_DECLSPEC void orte_rml_base_post_recv(int sd, short args, void *cbdata);
261261
ORTE_DECLSPEC void orte_rml_base_process_msg(int fd, short flags, void *cbdata);
262-
ORTE_DECLSPEC void orte_rml_base_complete_recv_msg (orte_rml_recv_t **recv_msg);
263262

264263

265264
/* Stub API interfaces to cycle through active plugins */

orte/mca/rml/base/rml_base_msg_handlers.c

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow
@@ -117,12 +117,57 @@ void orte_rml_base_post_recv(int sd, short args, void *cbdata)
117117
OBJ_RELEASE(req);
118118
}
119119

120-
void orte_rml_base_complete_recv_msg (orte_rml_recv_t **recv_msg)
120+
static void msg_match_recv(orte_rml_posted_recv_t *rcv, bool get_all)
121+
{
122+
opal_list_item_t *item, *next;
123+
orte_rml_recv_t *msg;
124+
orte_ns_cmp_bitmask_t mask = ORTE_NS_CMP_ALL | ORTE_NS_CMP_WILD;
125+
126+
/* scan thru the list of unmatched recvd messages and
127+
* see if any matches this spec - if so, push the first
128+
* into the recvd msg queue and look no further
129+
*/
130+
item = opal_list_get_first(&orte_rml_base.unmatched_msgs);
131+
while (item != opal_list_get_end(&orte_rml_base.unmatched_msgs)) {
132+
next = opal_list_get_next(item);
133+
msg = (orte_rml_recv_t*)item;
134+
opal_output_verbose(5, orte_rml_base_framework.framework_output,
135+
"%s checking recv for %s against unmatched msg from %s",
136+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
137+
ORTE_NAME_PRINT(&rcv->peer),
138+
ORTE_NAME_PRINT(&msg->sender));
139+
140+
/* since names could include wildcards, must use
141+
* the more generalized comparison function
142+
*/
143+
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &msg->sender, &rcv->peer) &&
144+
msg->tag == rcv->tag) {
145+
ORTE_RML_ACTIVATE_MESSAGE(msg);
146+
opal_list_remove_item(&orte_rml_base.unmatched_msgs, item);
147+
if (!get_all) {
148+
break;
149+
}
150+
}
151+
item = next;
152+
}
153+
}
154+
155+
void orte_rml_base_process_msg(int fd, short flags, void *cbdata)
121156
{
157+
orte_rml_recv_t *msg = (orte_rml_recv_t*)cbdata;
122158
orte_rml_posted_recv_t *post;
123159
orte_ns_cmp_bitmask_t mask = ORTE_NS_CMP_ALL | ORTE_NS_CMP_WILD;
124160
opal_buffer_t buf;
125-
orte_rml_recv_t *msg = *recv_msg;
161+
162+
OPAL_OUTPUT_VERBOSE((5, orte_rml_base_framework.framework_output,
163+
"%s message received from %s for tag %d",
164+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
165+
ORTE_NAME_PRINT(&msg->sender),
166+
msg->tag));
167+
168+
OPAL_TIMING_EVENT((&tm_rml,"from %s %d bytes",
169+
ORTE_NAME_PRINT(&msg->sender), msg->iov.iov_len));
170+
126171
/* see if we have a waiting recv for this message */
127172
OPAL_LIST_FOREACH(post, &orte_rml_base.posted_recvs, orte_rml_posted_recv_t) {
128173
/* since names could include wildcards, must use
@@ -184,52 +229,3 @@ void orte_rml_base_complete_recv_msg (orte_rml_recv_t **recv_msg)
184229
msg->tag));
185230
opal_list_append(&orte_rml_base.unmatched_msgs, &msg->super);
186231
}
187-
188-
static void msg_match_recv(orte_rml_posted_recv_t *rcv, bool get_all)
189-
{
190-
opal_list_item_t *item, *next;
191-
orte_rml_recv_t *msg;
192-
orte_ns_cmp_bitmask_t mask = ORTE_NS_CMP_ALL | ORTE_NS_CMP_WILD;
193-
194-
/* scan thru the list of unmatched recvd messages and
195-
* see if any matches this spec - if so, push the first
196-
* into the recvd msg queue and look no further
197-
*/
198-
item = opal_list_get_first(&orte_rml_base.unmatched_msgs);
199-
while (item != opal_list_get_end(&orte_rml_base.unmatched_msgs)) {
200-
next = opal_list_get_next(item);
201-
msg = (orte_rml_recv_t*)item;
202-
opal_output_verbose(5, orte_rml_base_framework.framework_output,
203-
"%s checking recv for %s against unmatched msg from %s",
204-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
205-
ORTE_NAME_PRINT(&rcv->peer),
206-
ORTE_NAME_PRINT(&msg->sender));
207-
208-
/* since names could include wildcards, must use
209-
* the more generalized comparison function
210-
*/
211-
if (OPAL_EQUAL == orte_util_compare_name_fields(mask, &msg->sender, &rcv->peer) &&
212-
msg->tag == rcv->tag) {
213-
ORTE_RML_ACTIVATE_MESSAGE(msg);
214-
opal_list_remove_item(&orte_rml_base.unmatched_msgs, item);
215-
if (!get_all) {
216-
break;
217-
}
218-
}
219-
item = next;
220-
}
221-
}
222-
223-
void orte_rml_base_process_msg(int fd, short flags, void *cbdata)
224-
{
225-
orte_rml_recv_t *msg = (orte_rml_recv_t*)cbdata;
226-
OPAL_OUTPUT_VERBOSE((5, orte_rml_base_framework.framework_output,
227-
"%s message received from %s for tag %d",
228-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
229-
ORTE_NAME_PRINT(&msg->sender),
230-
msg->tag));
231-
232-
OPAL_TIMING_EVENT((&tm_rml,"from %s %d bytes",
233-
ORTE_NAME_PRINT(&msg->sender), msg->iov.iov_len));
234-
orte_rml_base_complete_recv_msg(&msg);
235-
}

0 commit comments

Comments
 (0)