Limit retry count value to 6

This commit is contained in:
Felix Ableitner 2016-08-20 16:18:46 +02:00
parent 882b518a7c
commit e886f1563a

View file

@ -46,9 +46,11 @@ class MessageBuffer(localAddress: Address, retryMessageSending: (Address) => Uni
/**
* Calculates the duration until the next retry, measured from the time the message was added.
*
* retryCount is limited to a value of 6.
*/
private def calculateNextRetryOffset(retryCount: Int) =
Duration.standardSeconds(10 ^ (retryCount + 1))
Duration.standardSeconds(10 ^ Math.min(6, retryCount + 1))
/**
* Starts a timer to retry the route discovery.