| 8514 | } |
| 8515 | |
| 8516 | static void disconnect(rem_port* port, bool rmRef) |
| 8517 | { |
| 8518 | /************************************** |
| 8519 | * |
| 8520 | * d i s c o n n e c t |
| 8521 | * |
| 8522 | ************************************** |
| 8523 | * |
| 8524 | * Functional description |
| 8525 | * Disconnect a port and free its memory. |
| 8526 | * |
| 8527 | **************************************/ |
| 8528 | |
| 8529 | finalize(port); |
| 8530 | |
| 8531 | Rdb* rdb = port->port_context; |
| 8532 | port->port_context = nullptr; |
| 8533 | |
| 8534 | // Clear context reference for the associated event handler |
| 8535 | // to avoid SEGV during shutdown |
| 8536 | |
| 8537 | if (port->port_async) |
| 8538 | { |
| 8539 | port->port_async->port_context = NULL; |
| 8540 | port->port_async->port_flags |= PORT_disconnect; |
| 8541 | } |
| 8542 | |
| 8543 | // Perform physical network disconnect and release |
| 8544 | // memory for remote database context. |
| 8545 | |
| 8546 | port->port_flags |= PORT_disconnect; |
| 8547 | port->disconnect(); |
| 8548 | delete rdb; |
| 8549 | |
| 8550 | // Remove from active ports |
| 8551 | |
| 8552 | if (rmRef) |
| 8553 | outPorts->unRegisterPort(port); |
| 8554 | } |
| 8555 | |
| 8556 | |
| 8557 | static THREAD_ENTRY_DECLARE event_thread(THREAD_ENTRY_PARAM arg) |
no test coverage detected