| 5640 | |
| 5641 | |
| 5642 | ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL) |
| 5643 | { |
| 5644 | /************************************** |
| 5645 | * |
| 5646 | * r e c e i v e _ m s g |
| 5647 | * |
| 5648 | ************************************** |
| 5649 | * |
| 5650 | * Functional description |
| 5651 | * Receive a message. |
| 5652 | * |
| 5653 | **************************************/ |
| 5654 | |
| 5655 | // Find the database, request, message number, and the number of |
| 5656 | // messages the client is willing to cope with. Then locate the |
| 5657 | // message control block for the request and message type. |
| 5658 | |
| 5659 | Rrq* requestL; |
| 5660 | getHandle(requestL, data->p_data_request); |
| 5661 | |
| 5662 | const USHORT level = data->p_data_incarnation; |
| 5663 | requestL = REMOTE_find_request(requestL, level); |
| 5664 | const USHORT msg_number = data->p_data_message_number; |
| 5665 | USHORT count, count2; |
| 5666 | count2 = count = data->p_data_messages; |
| 5667 | |
| 5668 | LocalStatus ls; |
| 5669 | CheckStatusWrapper status_vector(&ls); |
| 5670 | |
| 5671 | if (msg_number > requestL->rrq_max_msg) |
| 5672 | { |
| 5673 | (Arg::Gds(isc_badmsgnum)).copyTo(&status_vector); |
| 5674 | return this->send_response(sendL, 0, 0, &status_vector, false); |
| 5675 | } |
| 5676 | Rrq::rrq_repeat* tail = &requestL->rrq_rpt[msg_number]; |
| 5677 | const rem_fmt* format = tail->rrq_format; |
| 5678 | |
| 5679 | // Get ready to ship the data out |
| 5680 | |
| 5681 | sendL->p_operation = op_send; |
| 5682 | sendL->p_data.p_data_request = data->p_data_request; |
| 5683 | sendL->p_data.p_data_message_number = msg_number; |
| 5684 | sendL->p_data.p_data_incarnation = level; |
| 5685 | sendL->p_data.p_data_messages = 1; |
| 5686 | |
| 5687 | // Check to see if any messages are already sitting around |
| 5688 | |
| 5689 | RMessage* message = 0; |
| 5690 | |
| 5691 | while (true) |
| 5692 | { |
| 5693 | message = tail->rrq_xdr; |
| 5694 | |
| 5695 | // If we don't have a message cached, get one from the next layer down. |
| 5696 | |
| 5697 | if (!message->msg_address) |
| 5698 | { |
| 5699 | // If we have an error queued for delivery, send it now |
no test coverage detected