void BUILD_TCPIP_REQUEST(CTCPIPSystemSrvr* pnode) { CEE_tag_def* objtag_ = (CEE_tag_def*)pnode; const CEE_handle_def *call_id_ = &pnode->m_call_id; short operation_id = pnode->m_rhdr.operation_id; if(pnode->m_trans_begin_tag != 0) RESUMETRANSACTION(pnode->m_trans_begin_tag); DISPATCH_TCPIPRequest(objtag_, call_id_, operation_id); }
void BUILD_TCPIP_REQUEST(CTCPIPSystemSrvr* pnode) { SRVRTRACE_ENTER(FILE_TSS+18); CEE_tag_def* objtag_ = (CEE_tag_def*)pnode; const CEE_handle_def *call_id_ = &pnode->m_call_id; short operation_id = pnode->m_rhdr.operation_id; short tx_handle[10]; if(pnode->m_trans_begin_tag != 0 && GETTRANSID(&tx_handle[0]) != 0) RESUMETRANSACTION(pnode->m_trans_begin_tag); DISPATCH_TCPIPRequest(objtag_, call_id_, operation_id); SRVRTRACE_EXIT(FILE_TSS+18); }
void IOMessage( /* In */ CEE_tag_def objtag_ , /* In */ const CEE_handle_def *call_id_ , /* Out */ CEERCV_IOMessage_exc_ *exception_ , /* In */ const FS_Receiveinfo_Type *receiveInfo , /* In */ IDL_short dialogInfo , /* In */ const CEERCV_IOMessage_request_seq_ *request , /* Out */ IDL_short *error , /* Out */ CEERCV_IOMessage_reply_seq_ *reply ) { CEE_status sts = CEE_SUCCESS; CEE_handle_def call_id; memcpy(&call_id, call_id_, sizeof(CEE_handle_def)); char* buffer = (char *)request->_buffer + sizeof(HEADER); long length = request->_length - sizeof(HEADER); HEADER* hdr = (HEADER*)request->_buffer; CFSystemSrvr* pnode; unsigned short max_reply_count = receiveInfo->max_reply_count; short message_tag = receiveInfo->message_tag; *error = 0; exception_->exception_nr = 0; reply->_length = 0; reply->_buffer = NULL; switch(hdr->hdr_type) { case WRITE_REQUEST_FIRST: pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo); if (pnode == NULL) { *error = SRVR_ERR_NODE_WRITE_REQUEST_FIRST; IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); return; } RESET_ERRORS((long)pnode); pnode->m_message_tag = message_tag; memset(&pnode->m_whdr,0,sizeof(HEADER)); memcpy(&pnode->m_rhdr,hdr,sizeof(HEADER)); if(pnode->r_allocate(hdr->total_length) == NULL) { *error = SRVR_ERR_MEMORY_ALLOCATE; IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); return; } memcpy(pnode->m_rbuffer, buffer, length); pnode->m_curptr = pnode->m_rbuffer + length; IOMessage_short_res_(message_tag, &call_id, exception_, *error, reply); break; case WRITE_REQUEST_NEXT: pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo); if (pnode == NULL) { *error = SRVR_ERR_NODE_WRITE_REQUEST_NEXT; IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); return; } RESET_ERRORS((long)pnode); pnode->m_message_tag = message_tag; memset(&pnode->m_whdr,0,sizeof(HEADER)); memcpy(pnode->m_curptr, buffer, length); pnode->m_curptr += length; sts = IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); break; case READ_RESPONSE_FIRST: case READ_RESPONSE_NEXT: pnode = GTransport.m_FSystemSrvr_list->find_node(receiveInfo); if (pnode == NULL) { if (hdr->hdr_type == READ_RESPONSE_FIRST) *error = SRVR_ERR_NODE_READ_RESPONSE_FIRST; else *error = SRVR_ERR_NODE_READ_RESPONSE_NEXT; IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); return; } RESET_ERRORS((long)pnode); pnode->m_message_tag = message_tag; memset(&pnode->m_whdr,0,sizeof(HEADER)); if (hdr->hdr_type == READ_RESPONSE_FIRST) { memcpy(&call_id, &pnode->m_call_id, sizeof(CEE_handle_def)); pnode->m_max_reply_count = max_reply_count; if(pnode->m_trans_begin_tag != 0) RESUMETRANSACTION(pnode->m_trans_begin_tag); DISPATCH_IOMessage( (CEE_tag_def)pnode, &call_id, exception_, receiveInfo, dialogInfo, request, error, reply, hdr->operation_id ); length = pnode->m_reply_count; } else { length = pnode->m_curlength; buffer = pnode->m_curptr; if (length > max_reply_count) length = max_reply_count; reply->_length = length; reply->_buffer = (IDL_octet *)buffer; IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); } pnode->m_curlength -= length; pnode->m_curptr += length; if (pnode->m_curlength == 0) { if (pnode->m_rbuffer != NULL) { delete[] pnode->m_rbuffer; pnode->m_rbuffer = NULL; } if (pnode->m_wbuffer != NULL) { delete[] pnode->m_wbuffer; pnode->m_wbuffer = NULL; } DEALLOCATE_TEMP_MEMORY(&call_id); } break; case CLEANUP: GTransport.m_FSystemSrvr_list->cleanup_node(receiveInfo); IOMessage_short_res_( message_tag, &call_id, exception_, *error, reply); break; } }
// -------------------------------------------------------------------------- // TM_Transaction::join // -- join an existing transaction, private method // -------------------------------------------------------------------------- short TM_Transaction::join(bool pv_coordinator_role) { Tm_Req_Msg_Type lv_req; Tm_Rsp_Msg_Type lv_rsp; TMlibTrace(("TMLIB_TRACE : TM_Transaction::join ENTRY\n"), 2); if (!gv_tmlib.is_initialized()) gv_tmlib.initialize(); // if there is already an active tx, switch it out // allows user to do multiple JOINS if (gp_trans_thr->get_current() != NULL) { if (gp_trans_thr->get_current()->equal(iv_transid)) { iv_last_error = FEALREADYJOINED; TMlibTrace(("TMLIB_TRACE : JOINTRANSACTION_EXT returning error %d for seq num %d\n", iv_last_error, iv_transid.get_seq_num()), 1); return iv_last_error; } TMlibTrace(("TMLIB_TRACE : JOINTRANSACTION_EXT called with active tx\n"), 3); RESUMETRANSACTION(0); } // no joins or enlists if (iv_server) { iv_last_error = FEOK; iv_tag = gv_tmlib.new_tag(); gp_trans_thr->add_trans(this); TMlibTrace(("TMLIB_TRACE : TM_Transaction::join, server EXIT\n"), 2); return iv_last_error; } // do a join tmlib_init_req_hdr(TM_MSG_TYPE_JOINTRANSACTION, &lv_req); iv_transid.set_external_data_type(&lv_req.u.iv_join_trans.iv_transid); lv_req.u.iv_join_trans.iv_coord_role = pv_coordinator_role; lv_req.u.iv_join_trans.iv_pid = gv_tmlib.iv_my_pid; lv_req.u.iv_join_trans.iv_nid = gv_tmlib.iv_my_nid; iv_last_error = gv_tmlib.send_tm(&lv_req, &lv_rsp, iv_transid.get_node()); if (iv_last_error) { TMlibTrace(("TMLIB_TRACE : JOINTRANSACTION_EXT returning error %d for seq num %d\n", iv_last_error, iv_transid.get_seq_num()), 1); return iv_last_error; } iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error; if (iv_last_error) { TMlibTrace(("TMLIB_TRACE : Join returning error %d for txn seq num %d\n", lv_rsp.iv_msg_hdr.miv_err.error, iv_transid.get_seq_num()), 1); return iv_last_error; } iv_coordinator = pv_coordinator_role; iv_tag = gv_tmlib.new_tag(); gp_trans_thr->add_trans(this); if (!gv_tmlib.is_enlisted (iv_transid.get_node())) { TMlibTrace(("TMLIB_TRACE : TM_transaction::join, adding enlist for node %d\n", iv_transid.get_node()), 3); TM_Transid_Type lv_null_transid; lv_null_transid.id[0] = lv_null_transid.id[1] = lv_null_transid.id[2] = lv_null_transid.id[3] = 0; msg_mon_trans_enlist (iv_transid.get_node(), lv_rsp.u.iv_join_trans.iv_tm_pid, lv_null_transid); gv_tmlib.enlist(iv_transid.get_node()); } iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error; TMlibTrace(("TMLIB_TRACE : TM_transaction::join (seq num %d) EXIT\n", iv_transid.get_seq_num()), 2); return iv_last_error; }