Improved timer code

This commit is contained in:
Mathias Hall-Andersen
2017-07-27 23:45:37 +02:00
parent 47f8a3d89a
commit fb3fa4f915
6 changed files with 240 additions and 187 deletions

View File

@@ -37,6 +37,7 @@ const (
MessageCookieReplySize = 64
MessageTransportHeaderSize = 16
MessageTransportSize = MessageTransportHeaderSize + poly1305.TagSize // size of empty transport
MessageKeepaliveSize = MessageTransportSize
)
const (
@@ -253,8 +254,6 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer {
}
hash = mixHash(hash, msg.Timestamp[:])
// TODO: check for flood attack
// check for replay attack
return timestamp.After(handshake.lastTimestamp)