Example #1
0
 public void AddInAdapter(InAdapter adap, bool init)
 {
     Adapters.Add(adap);
     adap.SetLogger(Logger);
     //adap.SetConfig(null);
     if (init)
     {
         InitAdapter(adap);
     }
 }
Example #2
0
 protected override async Task OnConnectionResult(ConnectResultBase result)
 {
     if (result.Ok)
     {
         var r = (ConnectResult)result;
         if (r.Stream != null)
         {
             var handler = r.Adapter;
             var copier  = new MyStream.TwoWayCopier(r.Stream, DataStream)
             {
                 WhenCanReadFromLeft = r.WhenCanRead,
                 Logger = new Logger("->" + handler.Name, InAdapter.GetAdapter().Logger)
             };
             copier.SetCounters(handler.GetAdapter().BytesCountersRW, this.BytesCountersRW);
             EnsureSniffer();
             Sniffer.ListenToCopier(copier.CopierFromRight, copier.CopierFromLeft);
             await copier.Run();
         }
     }
 }