コード例 #1
0
        // Resends a msg, presumably after a failure event
        private void ResendMsg(Resend cmd)
        {
            Send(cmd.Key, cmd.Msg);

            _messagesReSent++;

            //_log.Info($"{Self.Path.Name} ReSending message {_messagesReSent} to kafka");
            // Update telemetry
            Context.IncrementCounter("ResendMsg");
        }
コード例 #2
0
        private async void SecondTimer_Elapsed(object State)
        {
            DateTime Now = DateTime.Now;

            try
            {
                if (Now >= this.nextPing)
                {
                    await this.PING();

                    this.nextPing = Now.AddMilliseconds(this.keepAliveSeconds * 500);
                }

                LinkedList <KeyValuePair <DateTime, OutputRecord> > Resend = null;

                lock (this.synchObj)
                {
                    foreach (KeyValuePair <DateTime, OutputRecord> P in this.packetByTimeout)
                    {
                        if (Now < P.Key)
                        {
                            break;
                        }

                        if (Resend is null)
                        {
                            Resend = new LinkedList <KeyValuePair <DateTime, OutputRecord> >();
                        }

                        Resend.AddLast(P);
                    }

                    if (Resend != null)
                    {
                        foreach (KeyValuePair <DateTime, OutputRecord> P in Resend)
                        {
                            this.packetByTimeout.Remove(P.Key);
                            this.timeoutByPacketIdentifier.Remove(P.Value.PacketIdentifier);
                        }
                    }
                }

                if (Resend != null)
                {
                    foreach (KeyValuePair <DateTime, OutputRecord> P in Resend)
                    {
                        await this.Write(P.Value.Packet, P.Value.PacketIdentifier, P.Value.Callback);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Critical(ex);
            }
        }
コード例 #3
0
ファイル: Sign_Up.cs プロジェクト: JyotHathi/FriendsProject
 private void Do()
 {
     Mno.Focus();
     Invalid.Text = "";
     Resend.Hide();
     SendB.Text       = "Send";
     Mno.Text         = "";
     otp.Text         = "";
     otp.Enabled      = false;
     UserID.Enabled   = true;
     Password.Enabled = true;
     Mno.Enabled      = true;
 }
コード例 #4
0
ファイル: MqttClient.cs プロジェクト: wu-xian/IoTGateway
        private void SecondTimer_Elapsed(object State)
        {
            DateTime Now = DateTime.Now;

            if (Now >= this.nextPing)
            {
                this.PING();
                this.nextPing = Now.AddMilliseconds(this.keepAliveSeconds * 500);
            }

            LinkedList <KeyValuePair <DateTime, OutputRecord> > Resend = null;

            lock (this.outputQueue)
            {
                foreach (KeyValuePair <DateTime, OutputRecord> P in this.packetByTimeout)
                {
                    if (Now < P.Key)
                    {
                        break;
                    }

                    if (Resend == null)
                    {
                        Resend = new LinkedList <KeyValuePair <DateTime, OutputRecord> >();
                    }

                    Resend.AddLast(P);
                }

                if (Resend != null)
                {
                    foreach (KeyValuePair <DateTime, OutputRecord> P in Resend)
                    {
                        this.packetByTimeout.Remove(P.Key);
                        this.timeoutByPacketIdentifier.Remove(P.Value.PacketIdentifier);
                    }
                }
            }

            if (Resend != null)
            {
                foreach (KeyValuePair <DateTime, OutputRecord> P in Resend)
                {
                    this.BeginWrite(P.Value.Packet, P.Value.PacketIdentifier, P.Value.Callback);
                }
            }
        }
コード例 #5
0
        public ActionResult ResendValidation(Resend model)
        {
            string connection     = ConfigurationManager.AppSettings["InternalAPIURL"];
            var    appAccessToken = WebUtils.GetVaultSecret("AppConnectionKey");

            ResendVerificationRequest  resendRequest  = new ResendVerificationRequest(connection, appAccessToken, model.EmailResend);
            ResendVerificationResponse resendResponse = resendRequest.Send();

            if (resendResponse.StatusCode == System.Net.HttpStatusCode.OK)
            {
                TempData["Success"] = "Another verification email was sent.";
                return(RedirectToAction("Index", "Account"));
            }
            else
            {
                TempData["Errors"] = "There was an error processing your request";
                return(RedirectToAction("Index", "Account"));
            }
        }
コード例 #6
0
ファイル: Sign_Up.cs プロジェクト: JyotHathi/FriendsProject
 private void timer1_Tick(object sender, EventArgs e)
 {
     Resend.Show();
 }
コード例 #7
0
        /// <summary>
        /// The system which handles recieving datagrams, converting
        /// them to their appropriate type, and passing basic information
        /// back to the client and / or the local application.
        /// </summary>
        private void StartReceiving()
        {
            IPEndPoint endPoint = null;

            byte[]   bytes;
            Datagram datagram;

            while (true)
            {
                if (!IsListening)
                {
                    continue;
                }

                try
                {
                    bytes = _client.Receive(ref endPoint);

                    if (!IsListening)
                    {
                        continue;
                    }

                    datagram = ParseDatagram(bytes);

                    switch (datagram)
                    {
                    // Datagram is reliable, but the ACK index is too high.
                    // Ask client to resend awaiting data.
                    case Reliable rel when rel.AckIndex > _ackExpectedIndex:
                        SendDatagram(Resend.CreateString(), false);                        break;

                    // Message is reliable, but the ACK index is too low.
                    // Already recieved datagram: simply resend ACK and return
                    case Reliable rel when rel.AckIndex < _ackExpectedIndex:
                        SendDatagram(Ack.CreateString(rel.AckIndex), false);               break;

                    // Message is reliable, and was the expected index.
                    // Accept message, send ACK, and invoke MessageRecieved event
                    case Reliable rel:
                        _ackExpectedIndex += 1;
                        SendDatagram(Ack.CreateString(rel.AckIndex), false);
                        MessageRecieved.Invoke(null, new DatagramCallback
                        {
                            Data         = rel.Data,
                            SendToServer = (data, isRel) => SendDatagram(data, isRel)
                        });                                                               break;

                    // Message contains request to resend packages
                    // Resend earliest package
                    case Resend _: ResendRel();                                           break;

                    // Message is an acknowledgement datagram
                    // Accept and remove awaiting AckResolver
                    case Ack ack: AcceptAck(ack.AckIndex);                                break;

                    // Message is unreliable - invoke MessageRecieved event
                    case Unreliable unrel:
                        MessageRecieved.Invoke(null, new DatagramCallback
                        {
                            Data         = unrel.Data,
                            SendToServer = (data, isRel) => SendDatagram(data, isRel)
                        });                                                               break;
                    }
                }
                catch (SocketException se)
                {
                    _displayDisconnection.Display();
                    throw se;
                }
            }
        }
コード例 #8
0
        public async Task <ResendResponse> ResendAsync(Resend resend, CancellationToken token)
        {
            var result = await SendRequestPost <Resend, ResendResponse>(resend, token);

            return(result);
        }