update_msg::update_msg(mxml_node_t* xml) { sessionkey = validate_chunk(findele(xml,"sessionkey",false)); mxml_node_t* node = mxmlFindElement(xml,xml,"havechunk",NULL,NULL,MXML_DESCEND); if(!(node == NULL || node->child == NULL )) { //log_error(string("New held chunk from client: ") + string(node->child->child->value.text.string)); //node = node->child->next; node = node->child; while(node != NULL) { if(node->child == NULL) { throw malformed_xml(string("Invalid fields in havechunk")); } newchunk.push_back(validate_chunk(string(node->child->value.text.string))); //log_error(string("New held chunk from client: ") + string(node->child->value.text.string)); node = mxmlFindElement(node,xml,"c",NULL,NULL,MXML_NO_DESCEND); } } node = mxmlFindElement(xml,xml,"wantchunk",NULL,NULL,MXML_DESCEND); if(!(node == NULL || node->child == NULL )) { //node = node->child->next; node = node->child; while(node != NULL) { if(node->child == NULL) { throw malformed_xml(string("Invalid fields in wantchunk")); } wantchunk.push_back(validate_chunk(string(node->child->value.text.string))); node = mxmlFindElement(node,xml,"c",NULL,NULL,MXML_NO_DESCEND); } } #ifdef CASCADE_DEBUG stringstream irs; irs << "number of wantchunk from update message: " << wantchunk.size() << endl; log_error(irs.str()); #endif node = mxmlFindElement(xml,xml,"delchunk",NULL,NULL,MXML_DESCEND); if(!(node == NULL || node->child == NULL )) { //node = node->child->next; node = node->child; while(node != NULL) { if(node->child == NULL) { throw malformed_xml(string("Invalid fields in delchunk")); } delchunk.push_back(validate_chunk(string(node->child->value.text.string))); node = mxmlFindElement(node,xml,"c",NULL,NULL,MXML_NO_DESCEND); } } }
void ping_alonghandler(gasnet_token_t token, void *buf, size_t nbytes, gasnet_handlerarg_t iter, gasnet_handlerarg_t chunkidx) { uint8_t *srcbuf; INIT_CHECKS(); validate_chunk("AsyncLong Request", buf, nbytes, iter, chunkidx); if (INSEG(iter)) srcbuf = buf; else { srcbuf = alongreplysrc+chunkidx*nbytes; memcpy(srcbuf, buf, nbytes); } GASNET_Safe(gasnet_AMReplyLong2(token, hidx_pong_longhandler, srcbuf, nbytes, peerrepseg+(depth+chunkidx)*nbytes, iter, chunkidx)); }
void pong_longhandler(gasnet_token_t token, void *buf, size_t nbytes, gasnet_handlerarg_t iter, gasnet_handlerarg_t chunkidx) { INIT_CHECKS(); validate_chunk("Long Reply", buf, nbytes, iter, chunkidx); gasnett_atomic_increment(&pong_recvd,0); }
void ping_medhandler(gasnet_token_t token, void *buf, size_t nbytes, gasnet_handlerarg_t iter, gasnet_handlerarg_t chunkidx) { INIT_CHECKS(); validate_chunk("Medium Request", buf, nbytes, iter, chunkidx); GASNET_Safe(gasnet_AMReplyMedium2(token, hidx_pong_medhandler, buf, nbytes, iter, chunkidx)); }