コード例 #1
0
 private void EndInit()
 {
     if (this.Kind != SessionType.Store)
     {
         return;
     }
     if (!(dataSocketVerified && controlSocketVerified))
     {
         return;
     }
     logger.Log(Severity.TRIVIA, "Finishing storage session initialization.");
     // TODO: IMPORTANT  find a much better place to put all this
     pipeline.CryptoKey = this.CryptoKey;
     byte[] iv = new byte[16];
     Array.Copy(System.BitConverter.GetBytes(this.TaskId), iv, 8);
     Array.Copy(System.BitConverter.GetBytes(this.TaskId), 0, iv, 8, 8);
     pipeline.IV = iv;             //new byte[]{Conver
     pipeline.Init();
 }
コード例 #2
0
        internal ChunkProcessor(Session session, DataPipeline p, Backup b, CancellationToken t)
        {
            backup         = b;
            pipeline       = p;
            storageSession = session;
            token          = t;
            BinaryFormatter formatter = new BinaryFormatter();
            BChunkHeader    header    = new BChunkHeader();

            header.DataFlags = pipeline.Flags;
            header.Version   = Utilities.PlatForm.Instance().NodeVersion;
            header.TaskId    = session.TaskId;
            header.OwnerNode = b.NodeId;
            MemoryStream headerStream = new MemoryStream();

            formatter.Serialize(headerStream, header);
            headerData = headerStream.ToArray();

            // end-of-chain stream
            sessionDataStream = new NetworkStream(storageSession.DataSocket);
            p.OutputStream    = sessionDataStream;
            p.Init();
        }