MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / batch_gds_receive

Function batch_gds_receive

src/remote/client/interface.cpp:8285–8430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8283
8284
8285static void batch_gds_receive(rem_port* port,
8286 rmtque* que_inst,
8287 USHORT id)
8288{
8289/**************************************
8290 *
8291 * b a t c h _ g d s _ r e c e i v e
8292 *
8293 **************************************
8294 *
8295 * Functional description
8296 * Receive a batch of messages that were queued
8297 * on the wire.
8298 *
8299 * This function will be invoked whenever we need to wait
8300 * for something to come over on the wire, and there are
8301 * items in the queue for receipt.
8302 *
8303 * Note on error handing: Actual networking errors
8304 * need to be reported to status - which is bubbled
8305 * upwards to the API call which initiated this receive.
8306 * A status vector being returned as part of the cursor
8307 * fetch needs to be stored away for later return to the
8308 * client in the proper place in the stream.
8309 *
8310 **************************************/
8311
8312 fb_assert(port);
8313 fb_assert(que_inst);
8314 fb_assert(que_inst->rmtque_function == batch_gds_receive);
8315
8316 Rdb* rdb = que_inst->rmtque_rdb;
8317 Rrq* request = static_cast<Rrq*>(que_inst->rmtque_parm);
8318 Rrq::rrq_repeat* tail = que_inst->rmtque_message;
8319 PACKET *packet = &rdb->rdb_packet;
8320
8321 fb_assert(port == rdb->rdb_port);
8322
8323 bool clear_queue = false;
8324 // indicates whether queue is just being emptied, not retrieved
8325
8326 // always clear the complete queue for XNET, as we might
8327 // have incomplete packets
8328 if (id != request->rrq_id || port->port_type == rem_port::XNET)
8329 {
8330 clear_queue = true;
8331 }
8332
8333 // Avoid damaging preallocated buffer for response data
8334 UseStandardBuffer guard(packet->p_resp.p_resp_data);
8335
8336 // Receive the whole batch of records, until end-of-batch is seen
8337
8338 while (true)
8339 {
8340 RMessage* message = tail->rrq_xdr; // First free buffer
8341
8342 // If the buffer queue is full, allocate a new message and

Callers

nothing calls this directly

Calls 6

receive_packet_noqueueFunction · 0.85
dequeue_receiveFunction · 0.85
REMOTE_check_responseFunction · 0.85
saveStatusMethod · 0.80
RMessageClass · 0.50
valueMethod · 0.45

Tested by

no test coverage detected