1
1

- corrections to I/O forwarding - handling of incomplete writes

THESE CHANGES SHOULD BE PROPOGATED TO BOTH 1.0 and 1.1 BRANCHES

This commit was SVN r9734.
Этот коммит содержится в:
Tim Woodall 2006-04-26 15:36:06 +00:00
родитель 2a2b27bf57
Коммит 7a139d6cc8
2 изменённых файлов: 17 добавлений и 8 удалений

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

@ -481,6 +481,7 @@ int orte_iof_base_endpoint_forward(
frag->frag_owner = endpoint; frag->frag_owner = endpoint;
frag->frag_src = *src; frag->frag_src = *src;
frag->frag_hdr.hdr_msg = *hdr; frag->frag_hdr.hdr_msg = *hdr;
frag->frag_len = len;
/* call any registered callbacks */ /* call any registered callbacks */
for(item = opal_list_get_first(&endpoint->ep_callbacks); for(item = opal_list_get_first(&endpoint->ep_callbacks);
@ -498,6 +499,7 @@ int orte_iof_base_endpoint_forward(
if(endpoint->ep_fd >= 0) { if(endpoint->ep_fd >= 0) {
/* try to write w/out copying data */ /* try to write w/out copying data */
if(opal_list_get_size(&endpoint->ep_frags) == 0) { if(opal_list_get_size(&endpoint->ep_frags) == 0) {
if(len == 0) { if(len == 0) {
ORTE_IOF_BASE_FRAG_RETURN(frag); ORTE_IOF_BASE_FRAG_RETURN(frag);
@ -506,15 +508,19 @@ int orte_iof_base_endpoint_forward(
return ORTE_SUCCESS; return ORTE_SUCCESS;
} }
rc = write(endpoint->ep_fd,data,len); rc = write(endpoint->ep_fd,data,len);
if(rc < 0 && (errno != EAGAIN && errno != EINTR)) { if(rc < 0) {
ORTE_IOF_BASE_FRAG_RETURN(frag); if (errno != EAGAIN && errno != EINTR) {
orte_iof_base_endpoint_closed(endpoint); ORTE_IOF_BASE_FRAG_RETURN(frag);
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock); orte_iof_base_endpoint_closed(endpoint);
return ORTE_SUCCESS; OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
} return ORTE_SUCCESS;
}
rc = 0;
} else {
frag->frag_len -= rc;
}
} }
frag->frag_len = len - rc;
if(frag->frag_len > 0 || len == 0) { if(frag->frag_len > 0 || len == 0) {
/* handle incomplete write - also queue up 0 byte message /* handle incomplete write - also queue up 0 byte message
* and recognize this as a request to close the descriptor * and recognize this as a request to close the descriptor

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

@ -39,6 +39,9 @@ OBJ_CLASS_DECLARATION(orte_iof_base_frag_t);
if((frag = (orte_iof_base_frag_t*)item) == NULL) { \ if((frag = (orte_iof_base_frag_t*)item) == NULL) { \
opal_output(0, "ORTE_IOF_BASE_FRAG_ALLOC failed with status=%d\n", rc); \ opal_output(0, "ORTE_IOF_BASE_FRAG_ALLOC failed with status=%d\n", rc); \
} \ } \
frag->frag_owner = NULL; \
frag->frag_ptr = frag->frag_data; \
frag->frag_len = 0; \
} }
#define ORTE_IOF_BASE_FRAG_RETURN(frag) \ #define ORTE_IOF_BASE_FRAG_RETURN(frag) \