protected void HandleError(ReqrepType rt, int idnum, MemBlock err_data, ISender ret_path) { //Get the request: RequestState reqs; bool act; lock ( _sync ) { ///@todo, we might not want to stop listening after one error act = _req_state_table.TryTake(idnum, out reqs); } if (act) { #if REQREP_DEBUG Console.Error.WriteLine("[ReqrepManager: {0}] Receiving error on request id: {1}, from: {2}", _info, idnum, ret_path); #endif ///@todo make sure we are checking that this ret_path makes sense for ///our request ReqrepError rrerr = (ReqrepError)err_data[0]; reqs.ReplyHandler.HandleError(this, idnum, rrerr, ret_path, reqs.UserState); } else { //We have already dealt with this Request } }
/** Forget all state associated with this ReplyState * Not synchronized! You have to hold the lock! */ protected void ReleaseReplyState(ReplyState rs) { _reply_cache.Remove(rs.RequestKey); ReplyState tmp_rs; _reply_id_table.TryTake(rs.LocalID, out tmp_rs); }
/// <summary>A new identifier pair, may be incoming or outgoing.</summary> public int Add(IIdentifierPair idpair) { int local = 0; lock (_local_to_idpair) { local = _local_to_idpair.GenerateID(idpair); } try { idpair.LocalID = local; } catch { // Another idpairtext added the local id first... lock (_local_to_idpair) { _local_to_idpair.TryTake(local, out idpair); } } return(idpair.LocalID); }