private void OnError(IServerEventListener s, Exception e) { Console.Error.WriteLine("INFO: Exception thrown by client:"); Console.Error.WriteLine(e); eventMgr.UnregisterListener(s); }
private void OnTimeout(IServerEventListener s) { Console.Error.WriteLine("INFO: Client event timed out!"); eventMgr.UnregisterListener(s); }
public void UnregisterListener(IServerEventListener listener) { lock(server.Lock) { int index = -1; for(int i = 0; i < listeners.Count; i++) if(listeners[i] == listener) { index = i; break; } if(index >= 0) listeners.RemoveAt(index); } }
public void SendEvent(Event ev, IServerEventListener s) { try { ev(s); } catch(RemotingTimeoutException) { OnTimeout(s); } catch(Exception e) { OnError(s, e); } }
public void RegisterListener(IServerEventListener listener) { lock(server.Lock) if(!listeners.Any(l => l == listener)) listeners.Add(listener); }
public void AddEventListener(IServerEventListener listener) { _listener = listener; }
public void RegisterEventListener(IServerEventListener listener) { listeners.Add(listener); }
public void Subscribe(IServerEventListener listener) { this.listener = listener; }
public void UnregisterListener(IServerEventListener listener) { eventMgr.UnregisterListener(listener); }