bool mtsManagerProxyClient::Disconnect(const std::string & clientProcessName, const std::string & clientComponentName, const std::string & clientInterfaceName, const std::string & serverProcessName, const std::string & serverComponentName, const std::string & serverInterfaceName) { mtsManagerProxy::ConnectionStringSet connectionStringSet; GetConnectionStringSet(connectionStringSet, clientProcessName, clientComponentName, clientInterfaceName, serverProcessName, serverComponentName, serverInterfaceName); return SendDisconnect(connectionStringSet); }
void NetworkClient::Disconnect(bool send_disconnect) { StopLoginThread(); ScopeLock lock(&lock_); while (!socket_receive_filter_table_.empty()) { VSocket* _socket = socket_receive_filter_table_.begin()->first; KillIoSocket(_socket); } if (send_disconnect) { SendDisconnect(); } SetLoginAccountId(0); if (socket_) { Thread::Sleep(0.1); // Try to wait until data sent. SO_LINGER doesn't seem trustworthy. } Stop(); }
bool NetworkClient::Open(const str& local_address) { ScopeLock lock(&lock_); SendDisconnect(); Stop(); bool ok = !is_socket_connecting_; if (!ok) { log_.Warning("Already connecting (from some other thread?)..."); deb_assert(false); } SocketAddress _local_address; uint16 end_port = 0; if (ok) { ok = _local_address.ResolveRange(local_address, end_port); if (!ok) { log_.Warning("Unable to resolve public local address, network down?"); ok = true; uint8 ipv4[] = {0,0,0,0}; IPAddress ip_address(ipv4, sizeof(ipv4)); _local_address.Set(ip_address, 1025); end_port = 65534; } } if (ok) { //ScopeLock lock(&lock_); for (; _local_address.GetPort() <= end_port; _local_address.SetPort(_local_address.GetPort()+1)) { SetMuxSocket(new MuxSocket("Client ", _local_address, false)); if (mux_socket_->IsOpen()) { break; } delete (mux_socket_); mux_socket_ = 0; } ok = (mux_socket_ != 0); } return (ok); }
WarSocket::~WarSocket() { SendDisconnect(); }
bool mtsManagerProxyClient::Disconnect(const ConnectionIDType connectionID) { return SendDisconnect(connectionID); }