public virtual SessionDescription SetProfile(Profile newProfile) { AppLogger.Message("CommonStreamService.SetProfile " + newProfile.Name); #if USE_GLOBAL_GRAPHSERVICELOCK lock (_graphServiceLock) { #endif if (_graph != null) { try { if (newProfile.Name.ToLowerInvariant().Contains("custom")) { CurrentProfile = newProfile; } else { CurrentProfile = _graph.FindProfile(newProfile.Name); } if (CurrentProfile != null) { _graph.ChangeProfile(CurrentProfile); } return(null); } catch (ServerGraphRebuildException exc) { AppLogger.Dump(exc); AppLogger.Message("CommonStreamService.SetProfile() caught ServerGraphRebuildException--opening a new graph"); _graph.Stop(); _graph.State = ServerGraphState.Aborted; _graph.RemoveClient(this); // Save newProfile in the dictionary GraphManager.RemoveAndDisposeGraph(_graph); this.OpenGraphRequest.Profile = CurrentProfile; _graph = OpenGraph(); _graph.AddClient(this); SessionDescription sd = _graph.FillOutSessionDescription(this.OpenGraphRequest); return(sd); } } else { throw new ServiceHasNoGraphException(); } #if USE_GLOBAL_GRAPHSERVICELOCK } #endif }
public virtual SessionDescription Reconnect(ClientConnectRequest clientConnectRequest) { AppLogger.Message(clientConnectRequest.UserName + " Reconnect(" + clientConnectRequest.SourceName + ")"); #if USE_GLOBAL_GRAPHSERVICELOCK lock (_graphServiceLock) { #endif this.ClientConnectRequest = clientConnectRequest; this.ClientConnectRequest.InterfaceAddress = GetIncomingInterfaceAddress(); this.OpenGraphRequest.Update(this.ClientConnectRequest); this.OpenGraphRequest.ClientReconnecting = true; _graph = OpenGraph(); _graph.AddClient(this); SessionDescription sd = _graph.FillOutSessionDescription(this.OpenGraphRequest); return(sd); #if USE_GLOBAL_GRAPHSERVICELOCK } #endif }