protected void Disconnect(bool notify) { RealmServer.IOQueue.EnsureContext(); if (m_ClientProxy != null && m_ClientProxy.State != CommunicationState.Closed && m_ClientProxy.State != CommunicationState.Closing) { AddDisconnectWarningToTitle(); try { if (notify && m_ClientProxy.State == CommunicationState.Opened) { RealmServer.Instance.UnregisterRealm(); } lock (lck) { m_ClientProxy.Close(); m_ClientProxy = null; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause var evt = Disconnected; if (evt != null) { evt(this, null); } } }
protected void Disconnect(bool notify) { ServerApp <RealmServer> .IOQueue.EnsureContext(); if (m_ClientProxy == null || m_ClientProxy.State == CommunicationState.Closed || m_ClientProxy.State == CommunicationState.Closing) { return; } AddDisconnectWarningToTitle(); try { if (notify && m_ClientProxy.State == CommunicationState.Opened) { ServerApp <RealmServer> .Instance.UnregisterRealm(); } lock (lck) { m_ClientProxy.Close(); m_ClientProxy = null; } } catch { } EventHandler disconnected = Disconnected; if (disconnected == null) { return; } disconnected(this, null); }
/// <summary> /// Must be executed in RealmServer context /// </summary> protected bool Connect() { if (!m_warned) { AddDisconnectWarningToTitle(); log.Info(Resources.ConnectingToAuthServer); } RealmServer.IOQueue.EnsureContext(); Disconnect(true); m_ClientProxy = new AuthenticationClientAdapter(binding, new EndpointAddress(m_netAddr)); m_ClientProxy.Error += OnError; bool conn; try { m_ClientProxy.Open(); //if (!RealmServer.Instance.IsRegisteredAtAuthServer) RealmServer.Instance.RegisterRealm(); conn = IsConnected; lastUpdate = DateTime.Now; } catch (Exception e) { m_ClientProxy = null; if (e is EndpointNotFoundException) { if (!m_warned) { log.Error(Resources.IPCProxyFailed, UpdateInterval); } } else { LogUtil.ErrorException(e, Resources.IPCProxyFailedException, UpdateInterval); } conn = false; } m_warned = true; if (conn) { RearmDisconnectWarning(); var evt = Connected; if (evt != null) { evt(this, null); } } else { ScheduleReconnect(); } return(conn); }
protected void Disconnect(bool notify) { ServerApp <WCell.RealmServer.RealmServer> .IOQueue.EnsureContext(); if (this.m_ClientProxy == null || this.m_ClientProxy.State == CommunicationState.Closed || this.m_ClientProxy.State == CommunicationState.Closing) { return; } this.AddDisconnectWarningToTitle(); try { if (notify && this.m_ClientProxy.State == CommunicationState.Opened) { ServerApp <WCell.RealmServer.RealmServer> .Instance.UnregisterRealm(); } lock (this.lck) { this.m_ClientProxy.Close(); this.m_ClientProxy = (AuthenticationClientAdapter)null; } } catch { } EventHandler disconnected = this.Disconnected; if (disconnected == null) { return; } disconnected((object)this, (EventArgs)null); }
/// <summary>Must be executed in RealmServer context</summary> protected bool Connect() { if (!m_warned) { AddDisconnectWarningToTitle(); log.Info(WCell_RealmServer.ConnectingToAuthServer); } ServerApp <RealmServer> .IOQueue.EnsureContext(); Disconnect(true); m_ClientProxy = new AuthenticationClientAdapter(binding, new EndpointAddress(m_netAddr)); m_ClientProxy.Error += OnError; bool flag; try { m_ClientProxy.Open(); ServerApp <RealmServer> .Instance.RegisterRealm(); flag = IsConnected; lastUpdate = DateTime.Now; } catch (Exception ex) { m_ClientProxy = null; if (ex is EndpointNotFoundException) { if (!m_warned) { log.Error(WCell_RealmServer.IPCProxyFailed, UpdateInterval); } } else { LogUtil.ErrorException(ex, WCell_RealmServer.IPCProxyFailedException, (object)UpdateInterval); } flag = false; } m_warned = true; if (flag) { RearmDisconnectWarning(); EventHandler connected = Connected; if (connected != null) { connected(this, null); } } else { ScheduleReconnect(); } return(flag); }
protected void Disconnect(bool notify) { RealmServer.IOQueue.EnsureContext(); if (m_ClientProxy != null && m_ClientProxy.State != CommunicationState.Closed && m_ClientProxy.State != CommunicationState.Closing) { AddDisconnectWarningToTitle(); try { if (notify && m_ClientProxy.State == CommunicationState.Opened) { RealmServer.Instance.UnregisterRealm(); } lock (lck) { m_ClientProxy.Close(); m_ClientProxy = null; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause var evt = Disconnected; if (evt != null) { evt(this, null); } } }
/// <summary> /// Must be executed in RealmServer context /// </summary> protected bool Connect() { if (!m_warned) { AddDisconnectWarningToTitle(); log.Info(Resources.ConnectingToAuthServer); } RealmServer.IOQueue.EnsureContext(); Disconnect(true); m_ClientProxy = new AuthenticationClientAdapter(binding, new EndpointAddress(m_netAddr)); m_ClientProxy.Error += OnError; bool conn; try { m_ClientProxy.Open(); //if (!RealmServer.Instance.IsRegisteredAtAuthServer) RealmServer.Instance.RegisterRealm(); conn = IsConnected; lastUpdate = DateTime.Now; } catch (Exception e) { m_ClientProxy = null; if (e is EndpointNotFoundException) { if (!m_warned) { log.Error(Resources.IPCProxyFailed, UpdateInterval); m_warned = true; } } else { LogUtil.ErrorException(e, Resources.IPCProxyFailedException, UpdateInterval); } conn = false; } if (conn) { RearmDisconnectWarning(); var evt = Connected; if (evt != null) { evt(this, null); } } else { ScheduleReconnect(); } return conn; }
/// <summary> /// Must be executed in RealmServer context /// </summary> protected bool Connect() { RealmServer.Instance.EnsureContext(); Disconnect(true); m_ClientProxy = new AuthenticationClientAdapter(binding, new EndpointAddress(m_netAddr)); m_ClientProxy.Error += OnError; bool conn; try { m_ClientProxy.Open(); //if (!RealmServer.Instance.IsRegisteredAtAuthServer) RealmServer.Instance.RegisterRealm(); conn = IsConnected; lastUpdate = DateTime.Now; } catch (Exception e) { m_ClientProxy = null; if (!(e is EndpointNotFoundException)) { LogUtil.ErrorException(e, Resources.IPCProxyFailedException, ReconnectInterval); } else { log.Error(Resources.IPCProxyFailed, ReconnectInterval); } conn = false; } if (conn) { var evt = Connected; if (evt != null) { evt(this, null); } } else { Reconnect(); } return conn; }
public void Disconnect(bool notify) { if (m_ClientProxy != null && m_ClientProxy.State != CommunicationState.Closed && m_ClientProxy.State != CommunicationState.Closing) { try { if (notify && m_ClientProxy.State == CommunicationState.Opened) { RealmServer.Instance.UnregisterRealm(); } lock (lck) { m_ClientProxy.Close(); m_ClientProxy = null; } } // ReSharper disable EmptyGeneralCatchClause catch { } // ReSharper restore EmptyGeneralCatchClause var evt = Disconnected; if (evt != null) { evt(this, null); } } if (!m_IsRunning) { m_maintainConnTimer.Change(Timeout.Infinite, Timeout.Infinite); } }
public bool Connect() { Disconnect(true); Initialize(); bool conn; try { m_ClientProxy.Open(); //if (!RealmServer.Instance.IsRegisteredAtAuthServer) RealmServer.Instance.RegisterRealm(); if (conn = IsConnected) { m_maintainConnTimer.Change(UpdateInterval * 1000, UpdateInterval * 1000); } } catch (Exception e) { m_ClientProxy = null; if (!(e is EndpointNotFoundException)) { LogUtil.ErrorException(e, Resources.IPCProxyFailedException, ReconnectInterval); } else { log.Error(Resources.IPCProxyFailed, ReconnectInterval); } conn = false; } if (conn) { var evt = Connected; if (evt != null) { evt(this, null); } } else { Reconnect(); } return conn; }
void Initialize() { m_ClientProxy = new AuthenticationClientAdapter(binding, new EndpointAddress(m_netAddr)); m_ClientProxy.Error += OnError; }
/// <summary>Must be executed in RealmServer context</summary> protected bool Connect() { if (!this.m_warned) { this.AddDisconnectWarningToTitle(); AuthenticationClient.log.Info(WCell_RealmServer.ConnectingToAuthServer); } ServerApp <WCell.RealmServer.RealmServer> .IOQueue.EnsureContext(); this.Disconnect(true); this.m_ClientProxy = new AuthenticationClientAdapter((Binding)this.binding, new EndpointAddress(this.m_netAddr)); this.m_ClientProxy.Error += new Action <Exception>(this.OnError); bool flag; try { this.m_ClientProxy.Open(); ServerApp <WCell.RealmServer.RealmServer> .Instance.RegisterRealm(); flag = this.IsConnected; this.lastUpdate = DateTime.Now; } catch (Exception ex) { this.m_ClientProxy = (AuthenticationClientAdapter)null; if (ex is EndpointNotFoundException) { if (!this.m_warned) { AuthenticationClient.log.Error(WCell_RealmServer.IPCProxyFailed, AuthenticationClient.UpdateInterval); } } else { LogUtil.ErrorException(ex, WCell_RealmServer.IPCProxyFailedException, new object[1] { (object)AuthenticationClient.UpdateInterval }); } flag = false; } this.m_warned = true; if (flag) { this.RearmDisconnectWarning(); EventHandler connected = this.Connected; if (connected != null) { connected((object)this, (EventArgs)null); } } else { this.ScheduleReconnect(); } return(flag); }