public Task InvokeAsync( ConnectorContext context, IProvisionedSignal provisionedSignal, CancellationToken cancellationToken = default) { return(Task.CompletedTask); }
private void ConnectCallback(IAsyncResult ar) { ConnectorContext connector = (ConnectorContext)ar.AsyncState; try { connector.Socket.EndConnect(ar); } catch (Exception ex) { EndConnect(ex, connector); return; } SocketAsyncEventArgs readBuffer = new SocketAsyncEventArgs(); readBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); readBuffer.Completed += new EventHandler <SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); SocketAsyncEventArgs writeBuffer = new SocketAsyncEventArgs(); writeBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); writeBuffer.Completed += new EventHandler <SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); EndConnect(new AsyncDatagramSession(this, Processor, connector.Socket, connector.RemoteEP, new SocketAsyncEventArgsBuffer(readBuffer), new SocketAsyncEventArgsBuffer(writeBuffer), ReuseBuffer), connector); }
public ConnectorContext connector() { ConnectorContext _localctx = new ConnectorContext(Context, State); EnterRule(_localctx, 10, RULE_connector); int _la; try { EnterOuterAlt(_localctx, 1); { State = 40; _la = TokenStream.LA(1); if (!(_la == T__6 || _la == T__7)) { ErrorHandler.RecoverInline(this); } else { ErrorHandler.ReportMatch(this); Consume(); } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
/// <summary> /// Initializes the job synchronizing the project details /// </summary> /// <param name="projectService"><see cref="IProjectService"/></param> /// <param name="sisProjectService"><see cref="ISisProjectService"/></param> /// <param name="mspProjectService"><see cref="IMspProjectService"/></param> /// <param name="context"><see cref="ConnectorContext"/></param> public ProjectSyncJob(IProjectService projectService, ISisProjectService sisProjectService, IMspProjectService mspProjectService, ConnectorContext context) { _sisProjectService = sisProjectService; _mspProjectService = mspProjectService; _projectService = projectService; _context = context; }
private void ProcessConnect(SocketAsyncEventArgs e) { ConnectorContext connector = (ConnectorContext)e.UserToken; if (e.SocketError == SocketError.Success) { SocketAsyncEventArgs readBuffer = e; readBuffer.AcceptSocket = null; readBuffer.RemoteEndPoint = null; readBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); SocketAsyncEventArgs writeBuffer = new SocketAsyncEventArgs(); writeBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); writeBuffer.Completed += new EventHandler <SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); try { EndPoint localEP = connector.Socket.LocalEndPoint; EndPoint remoteEP = connector.Socket.RemoteEndPoint; EndConnect(new AsyncSocketSession(this, Processor, connector.Socket, localEP, remoteEP, new SocketAsyncEventArgsBuffer(readBuffer), new SocketAsyncEventArgsBuffer(writeBuffer), ReuseBuffer), connector); } catch (Exception ex) { Util.ExceptionMonitor.Instance.ExceptionCaught(ex); } } else { EndConnect(new SocketException((Int32)e.SocketError), connector); } }
public StatelessLinkConnector(string name, ConnectorContext context) : base(name, context) { _context = new InstanceContext(context.ChainName, Name, context.ChainConfiguration); using var serviceScope = context.ApplicationServices.CreateScope(); InstanceFactory.Create <TLink>(serviceScope.ServiceProvider, _context).Dispose(); }
public override Task <bool> ValidateAsync( ConnectorContext context, DeprovisionSignal signal, CancellationToken cancellationToken = default) { return(Task.FromResult(true)); }
protected Connector(string name, ConnectorContext context) { Name = name; InputType = typeof(TInput); OutputType = typeof(TOutput); _context = context; (Index, Depth) = context.Add(this); }
protected override void BeginConnect(ConnectorContext connector) { /* * No idea why get a SocketError.InvalidArgument in ConnectAsync. * Call BeginConnect instead. */ connector.Socket.BeginConnect(connector.RemoteEP, ConnectCallback, connector); }
/// <inheritdoc/> protected override void BeginConnect(ConnectorContext connector) { /* * No idea why get a SocketError.InvalidArgument in ConnectAsync. * Call BeginConnect instead. */ connector.Socket.BeginConnect(connector.RemoteEP, ConnectCallback, connector); }
public StatefulLinkConnector(string name, ConnectorContext context) : base(name, context) { var instanceContext = new InstanceContext(context.ChainName, Name, context.ChainConfiguration); _link = InstanceFactory.Create <TLink>(context.ApplicationServices, instanceContext); context.AddInit(_link.InitAsync); }
protected override IConnectFuture Connect0(EndPoint remoteEP, EndPoint localEP, Action<IoSession, IConnectFuture> sessionInitializer) { System.Net.Sockets.Socket socket = NewSocket(remoteEP.AddressFamily); if (localEP != null) socket.Bind(localEP); ConnectorContext ctx = new ConnectorContext(socket, remoteEP, sessionInitializer); BeginConnect(ctx); return ctx.Future; }
public async Task InvokeAsync( ConnectorContext context, DeprovisionSignal deprovisionSignal, CancellationToken cancellationToken = default) { await Agent .GetStateEngine <TypeState, TypeState>() .DeleteMachineAsync(context.Machine.MachineId, cancellationToken); }
/// <inheritdoc/> protected override void BeginConnect(ConnectorContext connector) { SocketAsyncEventArgs e = new SocketAsyncEventArgs(); e.Completed += new EventHandler<SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); e.RemoteEndPoint = connector.RemoteEP; e.UserToken = connector; Boolean willRaiseEvent = connector.Socket.ConnectAsync(e); if (!willRaiseEvent) ProcessConnect(e); }
/// <inheritdoc/> protected override IConnectFuture Connect0(EndPoint remoteEP, EndPoint localEP, Action <IoSession, IConnectFuture> sessionInitializer) { System.Net.Sockets.Socket socket = NewSocket(remoteEP.AddressFamily); if (localEP != null) { socket.Bind(localEP); } ConnectorContext ctx = new ConnectorContext(socket, remoteEP, sessionInitializer); BeginConnect(ctx); return(ctx); }
public async Task InvokeAsync( ConnectorContext context, ReserveSignal reserveSignal, CancellationToken cancellationToken = default) { await context.Machine.SignalAsync( new ProvisioningCompleteSignal { Reservation = reserveSignal }, cancellationToken); }
protected void EndConnect(IoSession session, ConnectorContext connector) { try { InitSession(session, connector.Future, connector.SessionInitializer); session.Processor.Add(session); } catch (Exception ex) { ExceptionMonitor.Instance.ExceptionCaught(ex); } _processor.IdleStatusChecker.Start(); }
/// <inheritdoc/> protected override void BeginConnect(ConnectorContext connector) { SocketAsyncEventArgs e = new SocketAsyncEventArgs(); e.Completed += new EventHandler <SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); e.RemoteEndPoint = connector.RemoteEP; e.UserToken = connector; Boolean willRaiseEvent = connector.Socket.ConnectAsync(e); if (!willRaiseEvent) { ProcessConnect(e); } }
/// <summary> /// Ends connecting. /// </summary> /// <param name="session">the connected session</param> /// <param name="connector">the context of current connector</param> protected void EndConnect(IoSession session, ConnectorContext connector) { try { InitSession(session, connector, connector.SessionInitializer); session.Processor.Add(session); } catch (Exception ex) { ExceptionMonitor.Instance.ExceptionCaught(ex); } _processor.IdleStatusChecker.Start(); }
private void ConnectCallback(IAsyncResult ar) { ConnectorContext connector = (ConnectorContext)ar.AsyncState; try { connector.Socket.EndConnect(ar); } catch (Exception ex) { EndConnect(ex, connector); return; } EndConnect(new AsyncSocketSession(this, Processor, connector.Socket, ReuseBuffer), connector); }
/// <summary> /// Dispatches the domain events /// </summary> /// <param name="mediator"><see cref="IMediator"/></param> /// <param name="ctx"><see cref="ConnectorContext"/></param> public static void DispatchDomainEvents(this IMediator mediator, ConnectorContext ctx) { var domainEntities = ctx.ChangeTracker .Entries <Entity>() .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any()).ToList(); var domainEvents = domainEntities .SelectMany(x => x.Entity.DomainEvents) .ToList(); domainEntities.ToList() .ForEach(entity => entity.Entity.ClearDomainEvents()); foreach (var domainEvent in domainEvents) { mediator.Publish(domainEvent); } }
private void ProcessConnect(SocketAsyncEventArgs e) { ConnectorContext connector = (ConnectorContext)e.UserToken; if (e.SocketError == SocketError.Success) { SocketAsyncEventArgs readBuffer = e; readBuffer.AcceptSocket = null; readBuffer.RemoteEndPoint = null; readBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); SocketAsyncEventArgs writeBuffer = new SocketAsyncEventArgs(); writeBuffer.SetBuffer(new Byte[SessionConfig.ReadBufferSize], 0, SessionConfig.ReadBufferSize); writeBuffer.Completed += new EventHandler <SocketAsyncEventArgs>(SocketAsyncEventArgs_Completed); EndConnect(new AsyncSocketSession(this, Processor, connector.Socket, new SocketAsyncEventArgsBuffer(readBuffer), new SocketAsyncEventArgsBuffer(writeBuffer), ReuseBuffer), connector); } else { EndConnect(new SocketException((Int32)e.SocketError), connector); } }
public TestInspectConnector(InitAction?onInit, ConnectorContext context) : base(nameof(TestInspectConnector <T>), context) { if (onInit is {})
public MappingConnector(MapperDelegate <TInput, TOutput> function, ConnectorContext context) : base(GetFunctionName(function), context) { _function = function; }
public ConditionalSubChainConnector(Predicate <TInput> predicate, Action <IConnectorLinker <TInput> > buildChain, ConnectorContext context) : base("Conditional", context) { _predicate = predicate; _conditionalConnector = ConnectorLinker <TInput> .CreateAndBuild(buildChain, context); }
public EnumerationConnector(Action <IConnectorLinker <T> > buildChain, ConnectorContext context) : base("Enumerate", context) { _connector = ConnectorLinker <T> .CreateAndBuild(buildChain, context); }
public Services(ConnectorContext context) : base(context) { }
/// <summary> /// Ends connecting. /// </summary> /// <param name="cause">the exception occurred</param> /// <param name="connector">the context of current connector</param> protected void EndConnect(Exception cause, ConnectorContext connector) { connector.Exception = cause; connector.Socket.Close(); }
public CompletionConnector(string reason, ConnectorContext context) : base("Completion", context) { _reason = reason; }
/// <summary> /// Begins connecting. /// </summary> /// <param name="connector">the context of current connector</param> protected abstract void BeginConnect(ConnectorContext connector);
public DelayConnector(int millisecondsDelay, ConnectorContext context) : base(nameof(DelayConnector <T>), context) { _millisecondsDelay = millisecondsDelay; }
protected abstract void BeginConnect(ConnectorContext connector);
public Services(ConnectorContext context) { this.context = context; }
protected void EndConnect(Exception cause, ConnectorContext connector) { connector.Future.Exception = cause; connector.Socket.Close(); }
/// <inheritdoc/> protected override void BeginConnect(ConnectorContext connector) { connector.Socket.BeginConnect(connector.RemoteEP, ConnectCallback, connector); }
public SubChainConnector(Action <IConnectorLinker <TInput> > buildChain, ConnectorContext context) : base("SubChain", context) { _connector = ConnectorLinker <TInput> .CreateAndBuild(buildChain, context); }