| 2988 | |
| 2989 | |
| 2990 | void rem_port::disconnect(PACKET* sendL, PACKET* receiveL) |
| 2991 | { |
| 2992 | /************************************** |
| 2993 | * |
| 2994 | * d i s c o n n e c t |
| 2995 | * |
| 2996 | ************************************** |
| 2997 | * |
| 2998 | * Functional description |
| 2999 | * We've lost the connection to the parent. Stop everything. |
| 3000 | * |
| 3001 | **************************************/ |
| 3002 | Rdb* rdb = this->port_context; |
| 3003 | |
| 3004 | if (this->port_flags & PORT_async) |
| 3005 | { |
| 3006 | if (!(this->port_flags & PORT_detached) && |
| 3007 | rdb && rdb->rdb_port && |
| 3008 | !(rdb->rdb_port->port_flags & (PORT_disconnect | PORT_detached))) |
| 3009 | { |
| 3010 | PACKET *packet = &rdb->rdb_packet; |
| 3011 | packet->p_operation = op_dummy; |
| 3012 | rdb->rdb_port->send(packet); |
| 3013 | } |
| 3014 | return; |
| 3015 | } |
| 3016 | |
| 3017 | this->port_flags |= PORT_disconnect; |
| 3018 | this->port_z_data = false; |
| 3019 | |
| 3020 | if (!rdb) |
| 3021 | { |
| 3022 | REMOTE_free_packet(this, sendL); |
| 3023 | REMOTE_free_packet(this, receiveL); |
| 3024 | this->disconnect(); |
| 3025 | return; |
| 3026 | } |
| 3027 | |
| 3028 | // For XNET we should send dummy op_disconnect packet |
| 3029 | // to wakeup async port handling events on client side. |
| 3030 | // For INET it's not necessary because INET client's async port |
| 3031 | // wakes up while server performs shutdown(socket) call on its async port. |
| 3032 | // See interface.cpp - event_thread(). |
| 3033 | |
| 3034 | PACKET *packet = &rdb->rdb_packet; |
| 3035 | if (this->port_async) |
| 3036 | { |
| 3037 | if (this->port_type == rem_port::XNET) |
| 3038 | { |
| 3039 | packet->p_operation = op_disconnect; |
| 3040 | this->port_async->send(packet); |
| 3041 | } |
| 3042 | this->port_async->port_flags |= PORT_disconnect; |
| 3043 | } |
| 3044 | |
| 3045 | LocalStatus ls; |
| 3046 | CheckStatusWrapper status_vector(&ls); |
| 3047 | if (rdb->rdb_iface) |
no test coverage detected