| 6356 | |
| 6357 | |
| 6358 | void Request::receive(CheckStatusWrapper* status, int level, unsigned int msg_type, |
| 6359 | unsigned int msg_length, void* msg) |
| 6360 | { |
| 6361 | /************************************** |
| 6362 | * |
| 6363 | * g d s _ r e c e i v e |
| 6364 | * |
| 6365 | ************************************** |
| 6366 | * |
| 6367 | * Functional description |
| 6368 | * Give a client program a record. Ask the |
| 6369 | * Remote server to send it to us if necessary. |
| 6370 | * |
| 6371 | **************************************/ |
| 6372 | try |
| 6373 | { |
| 6374 | reset(status); |
| 6375 | |
| 6376 | // Check handles and environment, then set up error handling |
| 6377 | |
| 6378 | CHECK_HANDLE(rq, isc_bad_req_handle); |
| 6379 | Rrq* request = REMOTE_find_request(rq, level); |
| 6380 | |
| 6381 | Rdb* rdb = request->rrq_rdb; |
| 6382 | CHECK_HANDLE(rdb, isc_bad_db_handle); |
| 6383 | rem_port* port = rdb->rdb_port; |
| 6384 | RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); |
| 6385 | |
| 6386 | Rrq::rrq_repeat* tail = &request->rrq_rpt[msg_type]; |
| 6387 | |
| 6388 | RMessage* message = tail->rrq_message; |
| 6389 | |
| 6390 | #ifdef DEBUG |
| 6391 | fprintf(stdout, "Rows Pending in REM_receive=%d\n", tail->rrq_rows_pending); |
| 6392 | #endif |
| 6393 | |
| 6394 | // Check to see if data is waiting. If not, solicit data. |
| 6395 | // Solicit data either when we've run out, or there's a low |
| 6396 | // inventory of messages in local buffers & no shipments on the |
| 6397 | // ether being sent to us. |
| 6398 | |
| 6399 | if (request->rrqStatus.isSuccess() && // No error pending |
| 6400 | ((!message->msg_address && tail->rrq_rows_pending == 0) || // No message waiting |
| 6401 | (tail->rrq_rows_pending <= tail->rrq_reorder_level && // Low in inventory |
| 6402 | tail->rrq_msgs_waiting <= tail->rrq_reorder_level && |
| 6403 | // Pipelining causes both server & client to |
| 6404 | // write at the same time. In XNET, writes |
| 6405 | // block for the other end to read - and so when both |
| 6406 | // attempt to write simultaenously, they end up |
| 6407 | // waiting indefinetly for the other end to read. |
| 6408 | (port->port_type != rem_port::XNET) && |
| 6409 | request->rrq_max_msg <= 1))) |
| 6410 | { |
| 6411 | // there's only one message type |
| 6412 | |
| 6413 | #ifdef DEBUG |
| 6414 | fprintf(stderr, "Rows Pending %d\n", tail->rrq_rows_pending); |
| 6415 | if (!message->msg_address) |
no test coverage detected