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

Method get_segment

src/remote/server/server.cpp:4459–4535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4457
4458
4459ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL)
4460{
4461/**************************************
4462 *
4463 * g e t _ s e g m e n t
4464 *
4465 **************************************
4466 *
4467 * Functional description
4468 * Get a single blob segment.
4469 *
4470 **************************************/
4471 Rbl* blob;
4472
4473 getHandle(blob, segment->p_sgmt_blob);
4474
4475 UCHAR temp_buffer[BLOB_LENGTH];
4476 USHORT buffer_length = segment->p_sgmt_length;
4477 UCHAR* buffer;
4478 if (buffer_length <= sizeof(temp_buffer))
4479 buffer = temp_buffer;
4480 else
4481 {
4482 if (buffer_length > blob->rbl_buffer_length)
4483 {
4484 blob->rbl_buffer = blob->rbl_data.getBuffer(buffer_length);
4485 blob->rbl_buffer_length = buffer_length;
4486 }
4487 buffer = blob->rbl_buffer;
4488 }
4489#ifdef DEBUG_REMOTE_MEMORY
4490 printf("get_segment(server) allocate buffer %x\n", buffer);
4491#endif
4492 sendL->p_resp.p_resp_data.cstr_address = buffer;
4493
4494 // Gobble up a buffer's worth of segments
4495
4496 LocalStatus ls;
4497 CheckStatusWrapper status_vector(&ls);
4498
4499 UCHAR* p = buffer;
4500 int state = 0;
4501
4502 while (buffer_length > 2)
4503 {
4504 buffer_length -= 2;
4505 p += 2;
4506 unsigned length;
4507 int cc = blob->rbl_iface->getSegment(&status_vector, buffer_length, p, &length);
4508 if (cc == IStatus::RESULT_NO_DATA || cc == IStatus::RESULT_ERROR)
4509 {
4510 if (cc == IStatus::RESULT_NO_DATA)
4511 state = 2;
4512 p -= 2;
4513 break;
4514 }
4515
4516 p[-2] = (UCHAR) length;

Callers 1

process_packetFunction · 0.80

Calls 3

send_responseMethod · 0.95
getBufferMethod · 0.45
getSegmentMethod · 0.45

Tested by

no test coverage detected