use before set, see #174 (thanks to @Glandos)

This commit is contained in:
Bora M. Alper 2019-09-18 01:22:34 +01:00
parent 0e9dcba5b6
commit d7bfbc7182
No known key found for this signature in database
GPG Key ID: 8F1A9504E1BD114D

View File

@ -36,8 +36,8 @@ type ProtocolEventHandlers struct {
func NewProtocol(laddr string, eventHandlers ProtocolEventHandlers) (p *Protocol) { func NewProtocol(laddr string, eventHandlers ProtocolEventHandlers) (p *Protocol) {
p = new(Protocol) p = new(Protocol)
p.transport = NewTransport(laddr, p.onMessage, p.eventHandlers.OnCongestion)
p.eventHandlers = eventHandlers p.eventHandlers = eventHandlers
p.transport = NewTransport(laddr, p.onMessage, p.eventHandlers.OnCongestion)
p.currentTokenSecret, p.previousTokenSecret = make([]byte, 20), make([]byte, 20) p.currentTokenSecret, p.previousTokenSecret = make([]byte, 20), make([]byte, 20)
_, err := rand.Read(p.currentTokenSecret) _, err := rand.Read(p.currentTokenSecret)