| 5530 | |
| 5531 | |
| 5532 | ISC_STATUS rem_port::que_events(P_EVENT * stuff, PACKET* sendL) |
| 5533 | { |
| 5534 | /************************************** |
| 5535 | * |
| 5536 | * q u e _ e v e n t s |
| 5537 | * |
| 5538 | ************************************** |
| 5539 | * |
| 5540 | * Functional description |
| 5541 | * |
| 5542 | **************************************/ |
| 5543 | LocalStatus ls; |
| 5544 | CheckStatusWrapper status_vector(&ls); |
| 5545 | |
| 5546 | Rdb* rdb = this->port_context; |
| 5547 | if (bad_db(&status_vector, rdb)) |
| 5548 | return this->send_response(sendL, 0, 0, &status_vector, false); |
| 5549 | |
| 5550 | // Find unused event block or, if necessary, a new one |
| 5551 | |
| 5552 | Rvnt* event; |
| 5553 | for (event = rdb->rdb_events; event; event = event->rvnt_next) |
| 5554 | { |
| 5555 | if (!event->rvnt_iface) |
| 5556 | { |
| 5557 | if (event->rvnt_destroyed.compareExchange(1, 0)) |
| 5558 | break; |
| 5559 | } |
| 5560 | } |
| 5561 | |
| 5562 | if (!event) |
| 5563 | { |
| 5564 | event = FB_NEW Rvnt; |
| 5565 | #ifdef DEBUG_REMOTE_MEMORY |
| 5566 | printf("que_events(server) allocate event %x\n", event); |
| 5567 | #endif |
| 5568 | event->rvnt_next = rdb->rdb_events; |
| 5569 | rdb->rdb_events = event; |
| 5570 | event->rvnt_callback = FB_NEW Callback(rdb, event); |
| 5571 | } |
| 5572 | |
| 5573 | event->rvnt_id = stuff->p_event_rid; |
| 5574 | event->rvnt_rdb = rdb; |
| 5575 | |
| 5576 | rem_port* asyncPort = rdb->rdb_port->port_async; |
| 5577 | if (!asyncPort || (asyncPort->port_flags & PORT_detached)) |
| 5578 | Arg::Gds(isc_net_event_connect_err).copyTo(&status_vector); |
| 5579 | else |
| 5580 | { |
| 5581 | RefMutexGuard portGuard(*asyncPort->port_sync, FB_FUNCTION); |
| 5582 | |
| 5583 | event->rvnt_iface = rdb->rdb_iface->queEvents(&status_vector, event->rvnt_callback, |
| 5584 | stuff->p_event_items.cstr_length, stuff->p_event_items.cstr_address); |
| 5585 | } |
| 5586 | |
| 5587 | return this->send_response(sendL, 0, 0, &status_vector, false); |
| 5588 | } |
| 5589 |
no test coverage detected