示例#1
0
        protected void HandleRequestAck(ReqrepType rt, int idnum, MemBlock rest, ISender ret_path)
        {
            RequestState reqs;

            lock ( _sync ) {
                if (_req_state_table.TryGet(idnum, out reqs))
                {
                    if (reqs.AddAck(ret_path))
                    {
                        /*
                         * Let's look at how long it took to get this reply:
                         */
                        TimeSpan rtt = DateTime.UtcNow - reqs.ReqDate;
                        if (ret_path is Edge)
                        {
                            _edge_reqtimeout = ComputeNewTimeOut(rtt.TotalMilliseconds,
                                                                 _edge_rtt_stats,
                                                                 _MINIMUM_TIMEOUT, _STD_DEVS);
                        }
                        else
                        {
                            _nonedge_reqtimeout = ComputeNewTimeOut(rtt.TotalMilliseconds,
                                                                    _nonedge_rtt_stats,
                                                                    _MINIMUM_TIMEOUT, _STD_DEVS);
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>Return the identifier pair given a local and remote id.</summary>
        public bool TryGet(int local_id, int remote_id,
                           out IIdentifierPair idpair)
        {
            lock (_local_to_idpair) {
                if (!_local_to_idpair.TryGet(local_id, out idpair))
                {
                    return(false);
                }
            }

            int c_rem_id = idpair.RemoteID;

            if (local_id != idpair.LocalID)
            {
                throw new Exception("Invalid local id");
            }
            else if (remote_id != c_rem_id)
            {
                if (c_rem_id != IdentifierPair.DEFAULT_ID)
                {
                    throw new Exception("Invalid remote id (expected, got): " +
                                        c_rem_id + ", " + remote_id);
                }
                idpair.RemoteID = remote_id;
            }
            return(true);
        }
示例#3
0
        protected void HandleRequestAck(ReqrepType rt, int idnum, MemBlock rest, ISender ret_path)
        {
            RequestState reqs;

            lock ( _sync ) {
                if (_req_state_table.TryGet(idnum, out reqs))
                {
                    if (reqs.AddAck(ret_path))
                    {
                        /*
                         * Let's look at how long it took to get this reply:
                         */
                        TimeSpan rtt = DateTime.UtcNow - reqs.ReqDate;
                        _to_mgr.AddAckSampleFor(reqs, ret_path, rtt);
                    }
                }
            }
        }