예제 #1
0
 public void ListenToCopier(MyStream.Copier clientSide, MyStream.Copier serverSide)
 {
     if (clientSide != null)
     {
         clientSide.OnRead += ClientData;
     }
     if (serverSide != null)
     {
         serverSide.OnRead += ServerData;
     }
 }
예제 #2
0
파일: InConnection.cs 프로젝트: hex11/Naive
        public MyStream.Copier CreateCopier(Adapter adapter, IMyStream myStream, bool toDest)
        {
            var dest    = Result.Stream;
            var ctrFrom = toDest ? adapter.BytesCountersRW : Result.Adapter.GetAdapter().BytesCountersRW;
            var ctrTo   = !toDest ? adapter.BytesCountersRW : Result.Adapter.GetAdapter().BytesCountersRW;
            var c       = new MyStream.Copier(toDest ? myStream : dest, !toDest ? myStream : dest)
            {
                CounterR = ctrFrom.R,
                CounterW = ctrTo.W,
                Logger   = adapter.Logger
            };

            Request.EnsureSniffer();
            Request.Sniffer.ListenToCopier(toDest ? c : null, !toDest ? null : c);
            return(c);
        }