Closed dscopra closed 7 years ago
internal class DataSourcePlayback : IDataSourcePlayback, IDisposable { private readonly ISchedulerService _schedulers; private readonly Subject<Data> _received_data_subject = new Subject<Data>(); private readonly Subject<byte[]> _received_rawdata_subject = new Subject<byte[]>(); private readonly Subject<byte[]> _send_rawdata_subject = new Subject<byte[]>(); private readonly Subject<Unit> _restart_subject = new Subject<Unit>(); public IObservable<Data> ReceivedData => _received_data_subject.AsObservable(); public IObservable<byte[]> ReceivedRawData => _received_rawdata_subject.AsObservable(); public IObservable<byte[]> SendRawData => _send_rawdata_subject.AsObservable(); public IObservable<Unit> Restart => _restart_subject.AsObservable(); private IDisposable _disposable; public DataSourcePlayback(ISchedulerService schedulers) { _schedulers = schedulers; } public void PlayFromNetworkStream() { _disposable?.Dispose(); _restart_subject.OnNext(Unit.Default); var listerner = new TcpListener(IPAddress.Any, 4001); listerner.Start(); var socket = listerner.AcceptSocket(); var network_stream = new NetworkStream(socket); var observableStream = new ObservableStream(_schedulers, network_stream); _disposable = new CompositeDisposable(network_stream, observableStream); } public void Dispose() { _received_data_subject.Dispose(); _received_rawdata_subject.Dispose(); _send_rawdata_subject.Dispose(); _restart_subject.Dispose(); _disposable.Dispose(); } }
Furthermore some LocalDecalration of IDisposable are not disposed, but arn't marked:
The problem seems to be connected with ObjectCreations, becauses MethodInvokationExpressions seems not to be affected: