| 2599 | |
| 2600 | |
| 2601 | static void aux_request( rem_port* port, /*P_REQ* request,*/ PACKET* send) |
| 2602 | { |
| 2603 | /************************************** |
| 2604 | * |
| 2605 | * a u x _ r e q u e s t |
| 2606 | * |
| 2607 | ************************************** |
| 2608 | * |
| 2609 | * Functional description |
| 2610 | * Other guy wants to establish a secondary connection. |
| 2611 | * Humor him. |
| 2612 | * |
| 2613 | **************************************/ |
| 2614 | |
| 2615 | try |
| 2616 | { |
| 2617 | LocalStatus ls; |
| 2618 | CheckStatusWrapper status_vector(&ls); |
| 2619 | |
| 2620 | Rdb* const rdb = port->port_context; |
| 2621 | if (bad_db(&status_vector, rdb)) |
| 2622 | { |
| 2623 | port->send_response(send, 0, 0, &status_vector, false); |
| 2624 | return; |
| 2625 | } |
| 2626 | |
| 2627 | // This buffer is used by INET transport |
| 2628 | // to return the server identification string |
| 2629 | UCHAR buffer[BUFFER_TINY]; |
| 2630 | send->p_resp.p_resp_data.cstr_address = buffer; |
| 2631 | |
| 2632 | // To be retrieved via an overloaded class member once our ports become real classes |
| 2633 | const int aux_port_id = (port->port_type == rem_port::INET) ? |
| 2634 | Config::getDefaultConfig()->getRemoteAuxPort() : 0; |
| 2635 | GlobalPortLock auxPortLock(aux_port_id); |
| 2636 | |
| 2637 | rem_port* const aux_port = port->request(send); |
| 2638 | |
| 2639 | port->send_response(send, rdb->rdb_id, send->p_resp.p_resp_data.cstr_length, |
| 2640 | &status_vector, false); |
| 2641 | |
| 2642 | if (status_vector.getState() & IStatus::STATE_ERRORS) |
| 2643 | { |
| 2644 | return; |
| 2645 | } |
| 2646 | |
| 2647 | if (aux_port) |
| 2648 | { |
| 2649 | fb_assert(aux_port->port_flags & PORT_connecting); |
| 2650 | bool connected = false; |
| 2651 | try |
| 2652 | { |
| 2653 | connected = aux_port->connect(send) != NULL; |
| 2654 | if (connected) |
| 2655 | { |
| 2656 | aux_port->port_context = rdb; |
| 2657 | aux_port->port_flags &= ~PORT_connecting; |
| 2658 | } |
no test coverage detected