1
1

minor fix to special mca_bml_base_send which randomly corrupts and drops

packets (used for testing). 

This commit was SVN r9378.
Этот коммит содержится в:
Galen Shipman 2006-03-23 15:04:43 +00:00
родитель 1439fb6e33
Коммит 0dd4af919d

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

@ -95,18 +95,25 @@ int mca_bml_base_send(
{
static int count;
des->des_context = bml_btl;
if(0 && count <= 0) {
if(count <= 0) {
count = (int) ((1000.0 * rand())/(RAND_MAX+1.0));
if(1 || count % 2) {
if(count % 2) {
/* local completion - network "drops" packet */
opal_output(0, "dropping data\n");
des->des_cbfunc(bml_btl->btl, bml_btl->btl_endpoint, des, OMPI_SUCCESS);
return OMPI_SUCCESS;
} else {
/* corrupt data */
mca_bml_base_context_t* ctx = (mca_bml_base_context_t*)
malloc(sizeof(mca_bml_base_context_t));
opal_output(0, "corrupting data\n");
if(NULL != ctx) {
ctx->index = (size_t) ((des->des_src[0].seg_len * rand() * 1.0) / (RAND_MAX + 1.0));
if(des->des_src[0].seg_len > 40 ) {
unsigned char temp;
ctx->index = 40;
temp = ((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index];
}
ctx->cbfunc = des->des_cbfunc;
ctx->cbdata = des->des_cbdata;
((unsigned char*)des->des_src[0].seg_addr.pval)[ctx->index] ^= ~0;