Ejemplo n.º 1
0
        MessageRec IMailbox.SaveSyncState(byte[] key, string syncState)
        {
            MrsTracer.ProxyClient.Function("RemoteMailbox.SaveSyncState", new object[0]);
            if (!(this is RemoteDestinationMailbox))
            {
                throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IMailbox_SaveSyncState");
            }
            this.VerifyMailboxConnection();
            IDataExport     dataExport      = new PagedTransmitter(syncState, base.MrsProxyClient.UseCompression);
            DataExportBatch dataExportBatch = dataExport.ExportData();
            long            handle          = base.MrsProxy.IDestinationMailbox_SaveSyncState2(base.Handle, key, dataExportBatch);

            if (!dataExportBatch.IsLastBatch)
            {
                using (IDataImport dataImport = new RemoteDataImport(base.MrsProxy, handle, null))
                {
                    do
                    {
                        dataExportBatch = dataExport.ExportData();
                        IDataMessage message = DataMessageSerializer.Deserialize(dataExportBatch.Opcode, dataExportBatch.Data, base.MrsProxyClient.UseCompression);
                        dataImport.SendMessage(message);
                    }while (!dataExportBatch.IsLastBatch);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
 public static void ExportRoutine(IMailboxReplicationProxyService mrsProxy, long dataExportHandle, IDataImport destProxy, DataExportBatch firstBatch, bool useCompression)
 {
     try
     {
         DataExportBatch dataExportBatch;
         do
         {
             if (firstBatch != null)
             {
                 dataExportBatch = firstBatch;
                 firstBatch      = null;
             }
             else
             {
                 if (TestIntegration.Instance.AbortConnectionDuringFX)
                 {
                     MailboxReplicationProxyClient mailboxReplicationProxyClient = (MailboxReplicationProxyClient)mrsProxy;
                     mailboxReplicationProxyClient.Abort();
                 }
                 dataExportBatch = mrsProxy.DataExport_ExportData2(dataExportHandle);
                 if (dataExportBatch.IsLastBatch)
                 {
                     dataExportHandle = 0L;
                 }
             }
             bool flag = false;
             try
             {
                 if (dataExportBatch.Opcode != 0)
                 {
                     IDataMessage message = DataMessageSerializer.Deserialize(dataExportBatch.Opcode, dataExportBatch.Data, useCompression);
                     destProxy.SendMessage(message);
                 }
                 if (dataExportBatch.FlushAfterImport)
                 {
                     destProxy.SendMessageAndWaitForReply(FlushMessage.Instance);
                 }
                 flag = true;
             }
             finally
             {
                 if (!flag && dataExportHandle != 0L)
                 {
                     MrsTracer.ProxyClient.Error("Exception was thrown during import/flush, canceling export.", new object[0]);
                     mrsProxy.DataExport_CancelExport(dataExportHandle);
                     dataExportHandle = 0L;
                 }
             }
         }while (!dataExportBatch.IsLastBatch);
     }
     finally
     {
         if (dataExportHandle != 0L)
         {
             mrsProxy.CloseHandle(dataExportHandle);
         }
     }
 }
Ejemplo n.º 3
0
        void IDataImport.SendMessage(IDataMessage message)
        {
            if (!this.useBuffering)
            {
                base.WrappedObject.SendMessage(message);
                return;
            }
            BufferBatchMessage bufferBatchMessage = message as BufferBatchMessage;

            if (bufferBatchMessage == null)
            {
                base.WrappedObject.SendMessage(message);
                return;
            }
            if (bufferBatchMessage.Buffer != null)
            {
                byte[] buffer;
                if (this.useCompression)
                {
                    buffer = CommonUtils.DecompressData(bufferBatchMessage.Buffer);
                }
                else
                {
                    buffer = bufferBatchMessage.Buffer;
                }
                using (MemoryStream memoryStream = new MemoryStream(buffer))
                {
                    using (BinaryReader binaryReader = new BinaryReader(memoryStream))
                    {
                        while (memoryStream.Position < memoryStream.Length)
                        {
                            int          opcode   = CommonUtils.ReadInt(binaryReader);
                            byte[]       data     = CommonUtils.ReadBlob(binaryReader);
                            IDataMessage message2 = DataMessageSerializer.Deserialize(opcode, data, this.useCompression);
                            base.WrappedObject.SendMessage(message2);
                        }
                    }
                }
            }
            if (bufferBatchMessage.FlushAfterImport)
            {
                base.WrappedObject.SendMessageAndWaitForReply(FlushMessage.Instance);
            }
        }
Ejemplo n.º 4
0
        void ISourceMailbox.SetMailboxSyncState(string syncState)
        {
            MrsTracer.ProxyClient.Function("RemoteSourceMailbox.SetMailboxSyncState", new object[0]);
            base.VerifyMailboxConnection();
            IDataExport     dataExport      = new PagedTransmitter(syncState, base.MrsProxyClient.UseCompression);
            DataExportBatch dataExportBatch = dataExport.ExportData();
            long            handle          = base.MrsProxy.ISourceMailbox_SetMailboxSyncState(base.Handle, dataExportBatch);

            if (!dataExportBatch.IsLastBatch)
            {
                using (IDataImport dataImport = new RemoteDataImport(base.MrsProxy, handle, null))
                {
                    do
                    {
                        dataExportBatch = dataExport.ExportData();
                        IDataMessage message = DataMessageSerializer.Deserialize(dataExportBatch.Opcode, dataExportBatch.Data, base.MrsProxyClient.UseCompression);
                        dataImport.SendMessage(message);
                    }while (!dataExportBatch.IsLastBatch);
                }
            }
        }