Fix some bugs in the spread rmcast component
This commit was SVN r23086.
Этот коммит содержится в:
родитель
8e7faf9119
Коммит
8c5f442ee0
@ -53,6 +53,7 @@ static opal_list_t channels;
|
|||||||
static bool init_completed = false;
|
static bool init_completed = false;
|
||||||
static orte_rmcast_channel_t next_channel;
|
static orte_rmcast_channel_t next_channel;
|
||||||
static opal_pointer_array_t msg_log;
|
static opal_pointer_array_t msg_log;
|
||||||
|
static char groups[256][MAX_GROUP_NAME];
|
||||||
|
|
||||||
static char private_group[MAX_GROUP_NAME];
|
static char private_group[MAX_GROUP_NAME];
|
||||||
static mailbox Mbox;
|
static mailbox Mbox;
|
||||||
@ -324,20 +325,6 @@ static void finalize(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iovec2scatter(scatter *out, struct iovec *msg, int count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0;i<count;i++) {
|
|
||||||
|
|
||||||
out->elements[i].buf = msg[i].iov_base;
|
|
||||||
out->elements[i].len = msg[i].iov_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
out->num_elements = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void internal_snd_cb(int status,
|
static void internal_snd_cb(int status,
|
||||||
orte_rmcast_channel_t channel,
|
orte_rmcast_channel_t channel,
|
||||||
orte_rmcast_tag_t tag,
|
orte_rmcast_tag_t tag,
|
||||||
@ -1399,36 +1386,67 @@ cleanup:
|
|||||||
static void recv_handler(int sd, short flags, void* cbdata)
|
static void recv_handler(int sd, short flags, void* cbdata)
|
||||||
{
|
{
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
ssize_t sz;
|
int sz;
|
||||||
rmcast_base_channel_t *chan = (rmcast_base_channel_t*)cbdata;
|
rmcast_base_channel_t *chan = (rmcast_base_channel_t*)cbdata;
|
||||||
service srvc;
|
service srvc;
|
||||||
char sender[MAX_GROUP_NAME], groups[2][MAX_GROUP_NAME];
|
char sender[MAX_GROUP_NAME];
|
||||||
int num_groups;
|
int num_groups, size_data;
|
||||||
int16 mess_type;
|
int16 mess_type;
|
||||||
int endian_mismatch;
|
int endian_mismatch;
|
||||||
|
|
||||||
/* Read all available spread messages. */
|
/* Read all available spread messages. */
|
||||||
while (SP_poll(sd) > 0) {
|
while (SP_poll(sd) > 0) {
|
||||||
|
|
||||||
data = (uint8_t*)malloc(mca_rmcast_spread_component.max_msg_size * sizeof(uint8_t));
|
size_data = mca_rmcast_spread_component.max_msg_size;
|
||||||
|
data = (uint8_t*)malloc(size_data * sizeof(uint8_t));
|
||||||
|
|
||||||
srvc = 0;
|
srvc = 0;
|
||||||
sz = SP_receive(sd, &srvc, sender, 2, &num_groups, groups, &mess_type, &endian_mismatch, mca_rmcast_spread_component.max_msg_size, (char *)data);
|
do {
|
||||||
|
sz = SP_receive(sd, &srvc, sender, 256, &num_groups, groups, &mess_type, &endian_mismatch, size_data, (char *)data);
|
||||||
|
|
||||||
if (sz <= 0) {
|
if (sz < 0) {
|
||||||
char error_string[1024];
|
char error_string[1024];
|
||||||
|
|
||||||
SP_error2str(sz, error_string);
|
SP_error2str(sz, error_string);
|
||||||
/* this shouldn't happen - report the errno */
|
/* this shouldn't happen - report the errno */
|
||||||
opal_output(0, "%s Error on multicast recv spread event: %s(%d:%d:%d)",
|
opal_output(0, "%s Error on multicast recv spread event: %s(%d:%d:%d)",
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), error_string, sz, num_groups, endian_mismatch);
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), error_string, sz, num_groups, endian_mismatch);
|
||||||
return;
|
switch (sz) {
|
||||||
|
case GROUPS_TOO_SHORT:
|
||||||
|
/*
|
||||||
|
* Just error out
|
||||||
|
*/
|
||||||
|
ORTE_ERROR_LOG(ORTE_ERR_TEMP_OUT_OF_RESOURCE);
|
||||||
|
exit(-1);
|
||||||
|
break;
|
||||||
|
case BUFFER_TOO_SHORT:
|
||||||
|
/*
|
||||||
|
* Size of buffer required is "-endian_mismatch" so we
|
||||||
|
* free the old data array and malloc a new one of the
|
||||||
|
* right size (-endian_mismatch)*sizeof(uint8_t).
|
||||||
|
*/
|
||||||
|
size_data = -endian_mismatch;
|
||||||
|
free(data);
|
||||||
|
data = (uint8_t*)malloc(size_data * sizeof(uint8_t));
|
||||||
|
if (!data) {
|
||||||
|
opal_output(0," %s Error in allocating data buffer for incoming message (%d)\n",
|
||||||
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),size_data);
|
||||||
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case ILLEGAL_SESSION:
|
||||||
|
case ILLEGAL_MESSAGE:
|
||||||
|
case CONNECTION_CLOSED:
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (sz < 0);
|
||||||
|
|
||||||
OPAL_OUTPUT_VERBOSE((2, orte_rmcast_base.rmcast_output,
|
OPAL_OUTPUT_VERBOSE((2, orte_rmcast_base.rmcast_output,
|
||||||
"%s rmcast:spread recvd %d bytes from channel %d(%s)",
|
"%s rmcast:spread recvd %d bytes from channel %d(%s)",
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||||
(int)sz, num_groups, groups[0]));
|
(int)sz, num_groups, groups[num_groups]));
|
||||||
|
|
||||||
if (Is_regular_mess(srvc)) {
|
if (Is_regular_mess(srvc)) {
|
||||||
int i;
|
int i;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user