示例#1
0
文件: Setup.cs 项目: 00mjk/Chabu
 public Setup(ChabuSetupInfo info, AbortMessage abortMessage, ChabuConnectingValidator connectingValidator)
 {
     this.infoLocal           = info;
     this.infoRemote          = new ChabuSetupInfo();
     this.abortMessage        = abortMessage;
     this.connectingValidator = connectingValidator;
 }
示例#2
0
 ///
 ///<summary>A single IChabuConnectingValidator instance can be configured. This is optional.</summary>
 ///
 /// When chabu is about to accept the connection, it calls this validator, so it can verify it
 /// can work with the application version number and name given by the communication partner.
 ///
 /// <param name="connectingValidator">the instance of the validator. Must not be <c>null</c>.</param>
 ///
 /// <returns>this ChabuBuilder instance. Use for fluent API style.</returns>
 ///
 public ChabuBuilder SetConnectionValidator(ChabuConnectingValidator connectingValidator)
 {
     Utils.ensure(connectingValidator != null, ChabuErrorCode.CONFIGURATION_VALIDATOR, "passed in null");
     Utils.ensure(this._connectingValidator == null, ChabuErrorCode.CONFIGURATION_VALIDATOR, "already set. Only one is allowed.");
     this._connectingValidator = connectingValidator;
     return(this);
 }
示例#3
0
        public ChabuImpl(ChabuFactory factory, ChabuSetupInfo localSetupInfo, int priorityCount,
                         List <ChabuChannelImpl> channels, Runnable xmitRequestListener, ChabuConnectingValidator connectingValidator)
        {
            this.notifierWhenRecvAndXmitCompletedStartup = new SingleEventNotifierFromTwoSources(eventCompletedStartup);
            this.xmitRequestListener = xmitRequestListener;
            verifyLocalSetup(localSetupInfo);
            xmitAbortMessage   = new AbortMessage(xmitRequestListener);
            this.channels      = channels;
            this.priorityCount = priorityCount;
            this.factory       = factory;

            this.setup = new Setup(localSetupInfo, xmitAbortMessage, connectingValidator);

            this.xmitter = factory.createXmitterStartup(xmitAbortMessage, xmitRequestListener, setup, xmitCompletedStartup);

            this.receiver = factory.createReceiverStartup(xmitAbortMessage, setup, recvCompletedStartup);
            verifyPriorityCount();
            verifyChannels();
        }