| 9773 | |
| 9774 | |
| 9775 | static void send_packet(rem_port* port, PACKET* packet) |
| 9776 | { |
| 9777 | /************************************** |
| 9778 | * |
| 9779 | * s e n d _ p a c k e t |
| 9780 | * |
| 9781 | ************************************** |
| 9782 | * |
| 9783 | * Functional description |
| 9784 | * Send a packet and check for a network error |
| 9785 | * on the send. |
| 9786 | * Make up a status vector for any error. |
| 9787 | * Note: SOME of the network lower level protocols |
| 9788 | * will set up a status vector when errors |
| 9789 | * occur, but other ones won't. |
| 9790 | * So this routine sets up an error result |
| 9791 | * for the vector and resets it to true |
| 9792 | * if the packet send occurred. |
| 9793 | * |
| 9794 | * See also cousin routine: receive_packet |
| 9795 | * |
| 9796 | **************************************/ |
| 9797 | |
| 9798 | RefMutexGuard guard(*port->port_write_sync, FB_FUNCTION); |
| 9799 | |
| 9800 | if (port->port_flags & PORT_detached || port->port_state == rem_port::BROKEN) |
| 9801 | { |
| 9802 | (Arg::Gds(isc_net_write_err) |
| 9803 | #ifdef DEV_BUILD |
| 9804 | << Arg::Gds(isc_random) << "port detached" |
| 9805 | #endif |
| 9806 | ).raise(); |
| 9807 | } |
| 9808 | |
| 9809 | // Send packets that were deferred |
| 9810 | |
| 9811 | if (port->port_deferred_packets) |
| 9812 | { |
| 9813 | for (rem_que_packet* p = port->port_deferred_packets->begin(); |
| 9814 | p < port->port_deferred_packets->end(); |
| 9815 | ++p) |
| 9816 | { |
| 9817 | if (!p->sent) |
| 9818 | { |
| 9819 | if (!port->send_partial(&p->packet)) |
| 9820 | (Arg::Gds(isc_net_write_err) << |
| 9821 | Arg::Gds(isc_random) << "send_packet/send_partial").raise(); |
| 9822 | |
| 9823 | p->sent = true; |
| 9824 | } |
| 9825 | } |
| 9826 | } |
| 9827 | |
| 9828 | if (!port->send(packet)) |
| 9829 | { |
| 9830 | (Arg::Gds(isc_net_write_err)<< Arg::Gds(isc_random) << "send_packet/send").raise(); |
| 9831 | } |
| 9832 | } |
no test coverage detected