summaryrefslogtreecommitdiff
path: root/satp/security-association.go
diff options
context:
space:
mode:
Diffstat (limited to 'satp/security-association.go')
-rw-r--r--satp/security-association.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/satp/security-association.go b/satp/security-association.go
index b004f47..f20e138 100644
--- a/satp/security-association.go
+++ b/satp/security-association.go
@@ -57,14 +57,14 @@ func (sa *SecurityAssociation) KeyGenerate(dir Direction, usage KeyUsage, sequen
func (sa *SecurityAssociation) EndpointUpdate(idx uint, ep *net.UDPAddr) {
if idx >= uint(len(sa.endpoints)) {
- return
+ return // panic???
}
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&(sa.endpoints[idx]))), unsafe.Pointer(ep))
}
func (sa *SecurityAssociation) EndpointCompareAndUpdate(idx uint, ep *net.UDPAddr) bool {
if idx >= uint(len(sa.endpoints)) {
- return false
+ return false // panic???
}
old := (*net.UDPAddr)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&(sa.endpoints[idx])))))
if !EndpointsEqual(old, ep) {
@@ -96,9 +96,6 @@ func (sa *SecurityAssociation) SequenceNumberCheckAndSet(senderID uint16, sequen
func NewSecurityAssociation(kd KeyDerivation, numEndpoints uint, initialSeqNrOutbound, initialSeqNrInbound uint32) (sa *SecurityAssociation) {
sa = &SecurityAssociation{kd: kd}
sa.endpoints = make([]*net.UDPAddr, numEndpoints)
- for i := range sa.endpoints {
- sa.endpoints[i] = &net.UDPAddr{}
- }
sa.nextSeqNr = initialSeqNrOutbound
sa.initialSeqNrInbound = initialSeqNrInbound
sa.seqWins = &sync.Map{}