本文整理汇总了C#中Exchange.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Exchange.Remove方法的具体用法?C# Exchange.Remove怎么用?C# Exchange.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exchange
的用法示例。
在下文中一共展示了Exchange.Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveEmptyMessage
/// <summary>
/// If we receive an ACK or RST, we mark the outgoing request or response
/// as acknowledged or rejected respectively and cancel its retransmission.
/// </summary>
public override void ReceiveEmptyMessage(INextLayer nextLayer, Exchange exchange, EmptyMessage message)
{
switch (message.Type)
{
case MessageType.ACK:
if (exchange.Origin == Origin.Local)
exchange.CurrentRequest.IsAcknowledged = true;
else
exchange.CurrentResponse.IsAcknowledged = true;
break;
case MessageType.RST:
if (exchange.Origin == Origin.Local)
exchange.CurrentRequest.IsRejected = true;
else
exchange.CurrentResponse.IsRejected = true;
break;
default:
if (log.IsWarnEnabled)
log.Warn("Empty messgae was not ACK nor RST: " + message);
break;
}
TransmissionContext ctx = (TransmissionContext)exchange.Remove(TransmissionContextKey);
if (ctx != null)
ctx.Cancel();
base.ReceiveEmptyMessage(nextLayer, exchange, message);
}
示例2: ClearBlockCleanup
/// <summary>
/// Clears the clean-up task.
/// </summary>
protected void ClearBlockCleanup(Exchange exchange)
{
Timer timer = exchange.Remove("BlockCleanupTimer") as Timer;
if (timer != null)
{
try
{
timer.Stop();
timer.Dispose();
}
catch (ObjectDisposedException)
{
// ignore
}
}
}
示例3: ReceiveResponse
/// <summary>
/// When we receive a Confirmable response, we acknowledge it and it also
/// counts as acknowledgment for the request. If the response is a duplicate,
/// we stop it here and do not forward it to the upper layer.
/// </summary>
public override void ReceiveResponse(INextLayer nextLayer, Exchange exchange, Response response)
{
TransmissionContext ctx = (TransmissionContext)exchange.Remove(TransmissionContextKey);
if (ctx != null)
{
exchange.CurrentRequest.IsAcknowledged = true;
ctx.Cancel();
}
if (response.Type == MessageType.CON && !exchange.Request.IsCancelled)
{
if (log.IsDebugEnabled)
log.Debug("Response is confirmable, send ACK.");
EmptyMessage ack = EmptyMessage.NewACK(response);
SendEmptyMessage(nextLayer, exchange, ack);
}
if (response.Duplicate)
{
if (log.IsDebugEnabled)
log.Debug("Response is duplicate, ignore it.");
}
else
{
base.ReceiveResponse(nextLayer, exchange, response);
}
}