private async Task <DebugModuleProperties> CreatePropertiesAsync(CancellationToken cancellation) { var properties = await DebugModuleProperties.ReadAsync(_stream, cancellation); // TODO: https://github.com/AI4E/AI4E/issues/102 // The messaging system does not guarantee message ordering. // The message may be delivered AFTER a DebugModuleDisconnected message for the same module that was sent thereafter. _debugServer._messageDispatcher.Dispatch(new DebugModuleConnected(properties), publish: true); return(properties); }
private async Task <ProxyHost> CreateProxyHostAsync(CancellationToken cancellation) { var tcpClient = await _tcpClientLazy.Task.WithCancellation(cancellation); var logger = _loggerFactory?.CreateLogger <DisposeAwareStream>(); // TODO: Graceful shutdown var stream = new DisposeAwareStream(tcpClient.GetStream(), () => { Environment.FailFast(""); return(Task.CompletedTask); }, logger); var endPoint = _remoteOptions.LocalEndPoint; var metadata = await _metadataAccessor.GetMetadataAsync(cancellation); var module = metadata.Module; var version = metadata.Version; var properties = new DebugModuleProperties(endPoint, module, version); await properties.WriteAsync(stream, cancellation); return(new ProxyHost(stream, _serviceProvider)); }
private Task DisposePropertiesAsync(DebugModuleProperties properties) { _debugServer._messageDispatcher.Dispatch(new DebugModuleDisconnected(properties), publish: true); return(Task.CompletedTask); }