@@ -53,7 +53,7 @@ namespace AzNetworking
|
||||
m_timeoutItemMap.erase(timeoutId);
|
||||
}
|
||||
|
||||
void TimeoutQueue::UpdateTimeouts(ITimeoutHandler& timeoutHandler, int32_t maxTimeouts)
|
||||
void TimeoutQueue::UpdateTimeouts(const TimeoutHandler& timeoutHandler, int32_t maxTimeouts)
|
||||
{
|
||||
int32_t numTimeouts = 0;
|
||||
if (maxTimeouts < 0)
|
||||
@@ -103,7 +103,7 @@ namespace AzNetworking
|
||||
|
||||
// By this point, the item is definitely timed out
|
||||
// Invoke the timeout function to see how to proceed
|
||||
const TimeoutResult result = timeoutHandler.HandleTimeout(mapItem);
|
||||
const TimeoutResult result = timeoutHandler(mapItem);
|
||||
|
||||
if (result == TimeoutResult::Refresh)
|
||||
{
|
||||
@@ -122,4 +122,10 @@ namespace AzNetworking
|
||||
m_timeoutItemMap.erase(itemTimeoutId);
|
||||
}
|
||||
}
|
||||
|
||||
void TimeoutQueue::UpdateTimeouts(ITimeoutHandler& timeoutHandler, int32_t maxTimeouts)
|
||||
{
|
||||
TimeoutHandler handler([&timeoutHandler](TimeoutQueue::TimeoutItem& item) { return timeoutHandler.HandleTimeout(item); });
|
||||
UpdateTimeouts(handler, maxTimeouts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ namespace AzNetworking
|
||||
//! @param timeoutId the identifier of the item to remove
|
||||
void RemoveItem(TimeoutId timeoutId);
|
||||
|
||||
//! Updates timeouts for all items, invokes the provided timeout functor if required.
|
||||
//! @param timeoutHandler lambda to invoke for all timeouts
|
||||
//! @param maxTimeouts the maximum number of timeouts to process before breaking iteration
|
||||
using TimeoutHandler = AZStd::function<TimeoutResult(TimeoutQueue::TimeoutItem&)>;
|
||||
void UpdateTimeouts(const TimeoutHandler& timeoutHandler, int32_t maxTimeouts = -1);
|
||||
|
||||
//! Updates timeouts for all items, invokes timeout handlers if required.
|
||||
//! @param timeoutHandler listener instance to call back on for timeouts
|
||||
//! @param maxTimeouts the maximum number of timeouts to process before breaking iteration
|
||||
|
||||
Reference in New Issue
Block a user