Exemple #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             try
             {
                 Worker.Dispose();
             }
             catch (Exception e)
             {
                 Trace.WriteLine($"Failed to dispose the worker: {e}");
             }
             if (!process.WaitForExit(3000))
             {
                 process.Kill();
             }
             ChannelServices.UnregisterChannel(channel);
         }
         Worker        = null;
         process       = null;
         channel       = null;
         disposedValue = true;
     }
 }
Exemple #2
0
        public RemoteProcessWorkerContainer()
        {
            var identifier = $"{Guid.NewGuid().ToString()}";
            var workerUrl  = $"ipc://sbrew-worker-{identifier}/worker";

            channel = new IpcChannel(
                new Hashtable()
            {
                ["name"]     = $"sbrew-{identifier}",
                ["portName"] = $"sbrew-{identifier}",
            },
                new BinaryClientFormatterSinkProvider(),
                null
                );
            ChannelServices.RegisterChannel(channel, false);

            startProcess(identifier);
            Worker = retrieveWorker(workerUrl);
        }