예제 #1
0
        public MemoryMessageChannel(byte id, ChannelParameters parameters, Settings settings) : base(id, parameters, settings)
        {
            this.maxQueue = parameters.MaxQueueSize > 0 ? parameters.MaxQueueSize : 1024;

            this.sendBuffer    = new ArrayReadWriteBuffer <Message>();
            this.receiveBuffer = new ArrayReadWriteBuffer <Message>();
        }
예제 #2
0
        public EventChannel() : base("EventChannel")
        {
            ChannelParameters eventChannelParameters = CreateEventChannelParam(true);

            messageChannel = new Channel(eventChannelParameters);
            messageChannel.SendEvent(CreateChannelEvent());
        }
예제 #3
0
        private ChannelParameters CreateEventChannelParam(bool ToStore)
        {
            ChannelParameters parameters = new ChannelParameters()
            {
                ChannelName = this.ChannelName,
                ClientID    = "EventChannelID",
                Store       = ToStore,
                Logger      = this.logger
            };

            return(parameters);
        }
예제 #4
0
        private ChannelParameters CreateRequestChannelParam(RequestType requestType)
        {
            ChannelParameters channelParameters = new ChannelParameters()
            {
                ChannelName  = this.ChannelName,
                ClientID     = this.ClientID,
                Timeout      = this.Timeout,
                CacheKey     = "",
                CacheTTL     = 0,
                Logger       = logger,
                RequestsType = requestType
            };

            return(channelParameters);
        }
예제 #5
0
        private ChannelParameters GetChannelParam()
        {
            ChannelParameters requestChannel = new ChannelParameters
            {
                ChannelName   = KubeMQChannel,
                ClientID      = $"Client:{KubeMQChannel}",
                KubeMQAddress = KubeMQ,
                Logger        = _logger,
                Timeout       = GetKubeMQTimeOut(),
                CacheKey      = "",
                CacheTTL      = 0,
                RequestsType  = RequestType.Query
            };

            return(requestChannel);
        }
예제 #6
0
        private LocalChannel CreateChannel(uint index, FundingTransaction fundingTx, OpenChannelMessage openMessage, AcceptChannelMessage acceptMessage)
        {
            LocalChannel channel = new LocalChannel();

            channel.ChannelIndex            = index;
            channel.TemporaryChannelId      = openMessage.TemporaryChannelId.ToHex();
            channel.LocalChannelParameters  = ChannelParameters.CreateFromOpenMessage(openMessage);
            channel.RemoteChannelParameters = ChannelParameters.CreateFromAcceptMessage(acceptMessage);
            channel.FundingSatoshis         = openMessage.FundingSatoshis;
            channel.PushMSat             = openMessage.PushMSat;
            channel.MinimumDepth         = acceptMessage.MinimumDepth;
            channel.FundingTransactionId = fundingTx.Transaction.GetHash().ToString();
            channel.FundingOutputIndex   = fundingTx.FundingOutputIndex;
            channel.ChannelId            = LocalChannel.DeriveChannelId(fundingTx.Transaction, fundingTx.FundingOutputIndex);
            channel.FeeRatePerKw         = openMessage.FeeratePerKw;

            return(channel);
        }
예제 #7
0
 public MemoryChannel(byte id, ChannelParameters parameters, Settings settings)
 {
     this.Id          = id;
     this.Direction   = parameters.Direction;
     this.Reliability = parameters.Reliability;
 }
예제 #8
0
 public override IMessageChannel <Message> GetMessageChannel <Message>(byte id, ChannelParameters parameters)
 {
     ref var channel = ref this.channels[id];
예제 #9
0
 private void SendCommandRequest()
 {
     requestChannelParameters = CreateRequestChannelParam(RequestType.Command);
     requestChannel           = new Channel(requestChannelParameters);
     requestChannel.SendRequest(CreateChannelRequest());
 }
예제 #10
0
 private void SendQueryRequest()
 {
     requestChannelParameters = CreateRequestChannelParam(RequestType.Query);
     requestChannel           = new Channel(requestChannelParameters);
     Response request = requestChannel.SendRequest(CreateChannelRequest());
 }