| 6274 | |
| 6275 | |
| 6276 | IEvents* Attachment::queEvents(CheckStatusWrapper* status, IEventCallback* callback, |
| 6277 | unsigned int length, const unsigned char* events) |
| 6278 | { |
| 6279 | /************************************** |
| 6280 | * |
| 6281 | * g d s _ $ q u e _ e v e n t s |
| 6282 | * |
| 6283 | ************************************** |
| 6284 | * |
| 6285 | * Functional description |
| 6286 | * Queue a request for event notification. |
| 6287 | * |
| 6288 | **************************************/ |
| 6289 | try |
| 6290 | { |
| 6291 | reset(status); |
| 6292 | |
| 6293 | CHECK_HANDLE(rdb, isc_bad_db_handle); |
| 6294 | rem_port* port = rdb->rdb_port; |
| 6295 | RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); |
| 6296 | |
| 6297 | // Validate data length |
| 6298 | |
| 6299 | CHECK_LENGTH(port, length); |
| 6300 | |
| 6301 | PACKET* packet = &rdb->rdb_packet; |
| 6302 | |
| 6303 | // If there isn't a auxiliary asynchronous port, make one now |
| 6304 | |
| 6305 | if (!port->port_async) |
| 6306 | { |
| 6307 | packet->p_operation = op_connect_request; |
| 6308 | P_REQ* request = &packet->p_req; |
| 6309 | request->p_req_object = rdb->rdb_id; |
| 6310 | request->p_req_type = P_REQ_async; |
| 6311 | send_packet(port, packet); |
| 6312 | receive_response(status, rdb, packet); |
| 6313 | port->connect(packet); |
| 6314 | |
| 6315 | rem_port* port_async = port->port_async; |
| 6316 | Thread::start(event_thread, port_async, THREAD_high, &port_async->port_events_thread); |
| 6317 | |
| 6318 | port_async->port_context = rdb; |
| 6319 | } |
| 6320 | |
| 6321 | // Add event block to port's list of active remote events |
| 6322 | |
| 6323 | Rvnt* rem_event = add_event(port); |
| 6324 | |
| 6325 | rem_event->rvnt_callback = callback; |
| 6326 | rem_event->rvnt_port = port->port_async; |
| 6327 | rem_event->rvnt_length = length; |
| 6328 | rem_event->rvnt_rdb = rdb; |
| 6329 | |
| 6330 | // Build the primary packet to get the operation started. |
| 6331 | |
| 6332 | packet = &rdb->rdb_packet; |
| 6333 | packet->p_operation = op_que_events; |
no test coverage detected