private void CloseConnetion() { try { _client.Client.Shutdown(SocketShutdown.Send); } catch (Exception) { Logger.LogWarning("Socket errored before shutdown and disconnect"); } Logger.LogInformation("Http no data to read, closed {0}", Id); RemoteDisconnected?.Invoke(this); }
/// <summary> /// Called on the client when a remote disconnects. /// </summary> /// <param name="writer"></param> protected virtual void OnRemoteDisconnected(NetworkWriter writer) { if (m_Connections == null) { return; } int connectionID = writer.ReadInt16(); RemoteDisconnected?.Invoke(m_Connections[connectionID]); DebugLog(string.Format("Remote {0} disconnected from the server.", connectionID)); m_Connections.Remove(connectionID); }
virtual internal void OnRemoteDisconnected(INetworkNode Remote) { if (Remote == null) { return; } Task.Run(() => { RemoteDisconnected?.Invoke(this, new InternetConnectionEventArgs { Local = this, Remote = Remote }); }); if ((Server != null) && (Remote.Socket == Server.Socket)) { Server = null; } }
virtual internal void OnRemoteDisconnected(INetworkNode Remote) { if (Remote == null) { return; } if (RemoteDisconnected != null) { Task.Run(() => { RemoteDisconnected?.Invoke(this, new InternetConnectionEventArgs { Local = this, Remote = Remote }); }); } if (Remotes.Contains(Remote)) { Remotes.Remove(Remote); } }
protected virtual void FireRemoteDisconnected(IPEndPoint remote, bool wasLastConnection = true) { RemoteDisconnected?.Invoke(remote, wasLastConnection); }