public Task ConnectAsync(Node node) { if (_isFailing) { throw new InvalidOperationException("making it fail"); } lock (this) { ConnectAsyncCallsCount++; } var session = new Session(30313, LimboLogs.Instance, Substitute.For <IChannel>(), node); lock (_sessions) { _sessions.Add(session); } SessionCreated?.Invoke(this, new SessionEventArgs(session)); return(Task.CompletedTask); }
private void InitializeChannel(IChannel channel, ISession session) { if (session.Direction == ConnectionDirection.In) { Metrics.IncomingConnections++; } else { Metrics.OutgoingConnections++; } if (_logger.IsTrace) { _logger.Trace($"|NetworkTrace| Initializing {session} channel"); } _sessionMonitor.AddSession(session); session.Disconnected += SessionOnPeerDisconnected; SessionCreated?.Invoke(this, new SessionEventArgs(session)); HandshakeRole role = session.Direction == ConnectionDirection.In ? HandshakeRole.Recipient : HandshakeRole.Initiator; var handshakeHandler = new NettyHandshakeHandler(_encryptionHandshakeService, session, role, session.RemoteNodeId, _logManager, _group); IChannelPipeline pipeline = channel.Pipeline; // pipeline.AddLast(new LoggingHandler(session.Direction.ToString().ToUpper(), DotNetty.Handlers.Logging.LogLevel.TRACE)); pipeline.AddLast("enc-handshake-dec", new LengthFieldBasedFrameDecoder(ByteOrder.BigEndian, ushort.MaxValue, 0, 2, 0, 0, true)); pipeline.AddLast("enc-handshake-handler", handshakeHandler); channel.CloseCompletion.ContinueWith(x => { if (_logger.IsTrace) { _logger.Trace($"|NetworkTrace| {session} channel disconnected"); } session.Disconnect(DisconnectReason.ClientQuitting, DisconnectType.Remote, "channel disconnected"); }); }
private async Task OnMessageAsync(BrokeredMessage message) { try { Trace.WriteLine($"Processing: { message.SequenceNumber }, Label: { message.Label }..."); string sessionId = $"{ message.Properties["SessionId"] }"; // message.SessionId string userId = $"{ message.Properties["UserId"] }"; SessionFound sessionFound = await SalesOrderActorSystem.SessionRouterActor.Ask <SessionFound>(new FindSession(sessionId), TimeSpan.FromSeconds(20)); if (sessionFound.SessionActor.IsNobody()) { SessionCreated sessionCreated = await SalesOrderActorSystem.SessionRouterActor.Ask <SessionCreated>(new CreateSession(sessionId, userId), TimeSpan.FromSeconds(20)); } // SessionCreated sessionCreated = await SalesOrderActorSystem.SessionRouterActor.Ask<SessionCreated>(new CreateSession(sessionId, userId), TimeSpan.FromSeconds(20)); } catch (Exception exception) { Trace.WriteLine(exception); } }
private void RegisterSession(IAudioSession session) { if (!_visibleSystemSounds && session.IsSystemSound) { session.Dispose(); return; } var audioSession = session as AudioSession; var fileName = audioSession.Process.GetMainModuleFileName(); // QUESTION: Should we use session.GroupingParam instead? // If we are able to grab the fileName for the process, group it with sessions from the same fileName if (!string.IsNullOrEmpty(fileName)) { var groupID = fileName.GetHashCode(); AudioSessionGroup sessionGroup; if (_sessions.TryGetValue(groupID, out var group)) { // We have a previously constrcuted group, so just add this session to that group and early out. sessionGroup = group as AudioSessionGroup; sessionGroup.AddSession(session); return; } // Need to create a new group for this session and register it sessionGroup = new AudioSessionGroup(groupID, session.DisplayName); sessionGroup.AddSession(session); session = sessionGroup; } _sessions.Add(session.ID, session); session.SessionEnded += OnSessionEnded; session.VolumeChanged += OnSessionVolumeChanged; SessionCreated?.Invoke(session); }
public void TriggerSessionCreated(IP2PSession session) { SessionCreated?.Invoke(this, new SessionEventArgs(session)); }
private void OnSessionCreated(SessionCreatedEventArgs e) { SessionCreated?.Invoke(this, e); }
public static void InvokeEvents(object sender, MushraTestDetailsModel e) { DisplaySession?.Invoke(sender, e); SessionCreated?.Invoke(sender, e); _sessionCreatedFlag = true; }
public void Apply(SessionCreated sessionCreated) { SessionCount++; }
private void RaiseSessionCreated(IWampClient client) { SessionCreated?.Invoke(this, new WampSessionEventArgs(client.SessionId)); }
internal static void NotifySessionCreating(object fileName, EventArgs e) { SessionCreated?.Invoke(fileName); }
public int OnSessionCreated(IntPtr newSession) { SessionCreated?.Invoke(this, new SessionCreatedNotificationEventArgs(newSession)); return(0); }
public void SessionCreated(SessionCreated sessionCreated) { hubContext.Clients.Client(sessionCreated.SessionId).sessionCreated(); }
private void NotifySessionCreated(VaspSession session) { var @event = new SessionCreatedEvent(session.SessionId); SessionCreated?.Invoke(@event); }
public void Handle(SessionCreated domainEvent) { _mailGateway .GetMailerWith("Session created", GetEmailBody(domainEvent, domainEvent.PresentationId)) .SendTo(_repository.Find <UserProfile>().AdminEmails()); }
protected virtual void RaiseSessionCreated(WampSessionCreatedEventArgs e) { SessionCreated?.Invoke(this, e); }
/// <summary> /// Raises the SessionCreated Event. /// </summary> /// <param name="args">The event data.</param> protected internal virtual void OnSessionCreated(SessionEventArgs args) { SessionCreated?.Invoke(this, args); }
public void Apply(SessionCreated @event) { State = AccountState.WithSession; }
/// <summary> /// Called whenever the <see cref="Session"/> has been created. /// </summary> /// <remarks> /// The <see cref="Session"/> can be created by calling <see cref="CreateSessionAsync"/>. /// </remarks> protected virtual void OnSessionCreated() { SessionCreated?.Invoke(this, EventArgs.Empty); }
/* * private void CreateSalesOrder(CreateSalesOrder createSalesOrder) * { * IActorRef sessionActor = Context.ActorSelection(SalesOrderActorRefs.SessionCollection).ResolveOne(TimeSpan.FromSeconds(10)).Result; * * sessionActor.Tell(createSalesOrder); * } * * private void DestroySalesOrder(DestroySalesOrder destroySalesOrder) * { * IActorRef sessionActor = Context.ActorSelection(SalesOrderActorRefs.SessionCollection).ResolveOne(TimeSpan.FromSeconds(10)).Result; * * sessionActor.Tell(destroySalesOrder); * } * * private void AddSalesOrderLine(AddSalesOrderLine addSalesOrderLine) * { * IActorRef sessionActor = Context.ActorSelection(SalesOrderActorRefs.SessionCollection).ResolveOne(TimeSpan.FromSeconds(10)).Result; * * sessionActor.Tell(addSalesOrderLine); * } * * private void RemoveSalesOrderLine(RemoveSalesOrderLine removeSalesOrderLine) * { * IActorRef sessionActor = Context.ActorSelection(SalesOrderActorRefs.SessionCollection).ResolveOne(TimeSpan.FromSeconds(10)).Result; * * sessionActor.Tell(removeSalesOrderLine); * } */ public void SessionCreated(SessionCreated sessionCreated) { SalesOrderEventSource.SessionCreated(sessionCreated); }