Reasonable punctuation given the spacing

This commit is contained in:
Jason A. Donenfeld 2018-05-21 02:50:39 +02:00
parent acb5481246
commit 84c5357cf3
3 changed files with 22 additions and 22 deletions

View file

@ -171,7 +171,7 @@ func (peer *Peer) Start() {
} }
device := peer.device device := peer.device
device.log.Debug.Println(peer, ": Starting...") device.log.Debug.Println(peer, "- Starting...")
// reset routine state // reset routine state
@ -241,7 +241,7 @@ func (peer *Peer) Stop() {
peer.routines.mutex.Lock() peer.routines.mutex.Lock()
defer peer.routines.mutex.Unlock() defer peer.routines.mutex.Unlock()
peer.device.log.Debug.Println(peer, ": Stopping...") peer.device.log.Debug.Println(peer, "- Stopping...")
peer.timersStop() peer.timersStop()

View file

@ -445,7 +445,7 @@ func (device *Device) RoutineHandshake() {
peer.endpoint = elem.endpoint peer.endpoint = elem.endpoint
peer.mutex.Unlock() peer.mutex.Unlock()
logDebug.Println(peer, ": Received handshake initiation") logDebug.Println(peer, "- Received handshake initiation")
peer.SendHandshakeResponse() peer.SendHandshakeResponse()
@ -478,7 +478,7 @@ func (device *Device) RoutineHandshake() {
peer.endpoint = elem.endpoint peer.endpoint = elem.endpoint
peer.mutex.Unlock() peer.mutex.Unlock()
logDebug.Println(peer, ": Received handshake response") logDebug.Println(peer, "- Received handshake response")
// update timers // update timers
@ -490,7 +490,7 @@ func (device *Device) RoutineHandshake() {
err = peer.BeginSymmetricSession() err = peer.BeginSymmetricSession()
if err != nil { if err != nil {
logError.Println(peer, ": Failed to derive keypair:", err) logError.Println(peer, "- Failed to derive keypair:", err)
continue continue
} }
@ -513,11 +513,11 @@ func (peer *Peer) RoutineSequentialReceiver() {
logDebug := device.log.Debug logDebug := device.log.Debug
defer func() { defer func() {
logDebug.Println(peer, ": Routine: sequential receiver - stopped") logDebug.Println(peer, "- Routine: sequential receiver - stopped")
peer.routines.stopping.Done() peer.routines.stopping.Done()
}() }()
logDebug.Println(peer, ": Routine: sequential receiver - started") logDebug.Println(peer, "- Routine: sequential receiver - started")
peer.routines.starting.Done() peer.routines.starting.Done()
@ -570,7 +570,7 @@ func (peer *Peer) RoutineSequentialReceiver() {
// check for keepalive // check for keepalive
if len(elem.packet) == 0 { if len(elem.packet) == 0 {
logDebug.Println(peer, ": Receiving keepalive packet") logDebug.Println(peer, "- Receiving keepalive packet")
continue continue
} }
peer.timersDataReceived() peer.timersDataReceived()

28
send.go
View file

@ -115,7 +115,7 @@ func (peer *Peer) SendKeepalive() bool {
elem.packet = nil elem.packet = nil
select { select {
case peer.queue.nonce <- elem: case peer.queue.nonce <- elem:
peer.device.log.Debug.Println(peer, ": Sending keepalive packet") peer.device.log.Debug.Println(peer, "- Sending keepalive packet")
return true return true
default: default:
return false return false
@ -142,11 +142,11 @@ func (peer *Peer) SendHandshakeInitiation(isRetry bool) error {
peer.handshake.lastSentHandshake = time.Now() peer.handshake.lastSentHandshake = time.Now()
peer.handshake.mutex.Unlock() peer.handshake.mutex.Unlock()
peer.device.log.Debug.Println(peer, ": Sending handshake initiation") peer.device.log.Debug.Println(peer, "- Sending handshake initiation")
msg, err := peer.device.CreateMessageInitiation(peer) msg, err := peer.device.CreateMessageInitiation(peer)
if err != nil { if err != nil {
peer.device.log.Error.Println(peer, ": Failed to create initiation message:", err) peer.device.log.Error.Println(peer, "- Failed to create initiation message:", err)
return err return err
} }
@ -161,7 +161,7 @@ func (peer *Peer) SendHandshakeInitiation(isRetry bool) error {
err = peer.SendBuffer(packet) err = peer.SendBuffer(packet)
if err != nil { if err != nil {
peer.device.log.Error.Println(peer, ": Failed to send handshake initiation", err) peer.device.log.Error.Println(peer, "- Failed to send handshake initiation", err)
} }
peer.timersHandshakeInitiated() peer.timersHandshakeInitiated()
@ -173,11 +173,11 @@ func (peer *Peer) SendHandshakeResponse() error {
peer.handshake.lastSentHandshake = time.Now() peer.handshake.lastSentHandshake = time.Now()
peer.handshake.mutex.Unlock() peer.handshake.mutex.Unlock()
peer.device.log.Debug.Println(peer, ": Sending handshake response") peer.device.log.Debug.Println(peer, "- Sending handshake response")
response, err := peer.device.CreateMessageResponse(peer) response, err := peer.device.CreateMessageResponse(peer)
if err != nil { if err != nil {
peer.device.log.Error.Println(peer, ": Failed to create response message:", err) peer.device.log.Error.Println(peer, "- Failed to create response message:", err)
return err return err
} }
@ -189,7 +189,7 @@ func (peer *Peer) SendHandshakeResponse() error {
err = peer.BeginSymmetricSession() err = peer.BeginSymmetricSession()
if err != nil { if err != nil {
peer.device.log.Error.Println(peer, ": Failed to derive keypair:", err) peer.device.log.Error.Println(peer, "- Failed to derive keypair:", err)
return err return err
} }
@ -199,7 +199,7 @@ func (peer *Peer) SendHandshakeResponse() error {
err = peer.SendBuffer(packet) err = peer.SendBuffer(packet)
if err != nil { if err != nil {
peer.device.log.Error.Println(peer, ": Failed to send handshake response", err) peer.device.log.Error.Println(peer, "- Failed to send handshake response", err)
} }
return err return err
} }
@ -333,7 +333,7 @@ func (peer *Peer) RoutineNonce() {
logDebug := device.log.Debug logDebug := device.log.Debug
defer func() { defer func() {
logDebug.Println(peer, ": Routine: nonce worker - stopped") logDebug.Println(peer, "- Routine: nonce worker - stopped")
peer.queue.packetInNonceQueueIsAwaitingKey.Set(false) peer.queue.packetInNonceQueueIsAwaitingKey.Set(false)
peer.routines.stopping.Done() peer.routines.stopping.Done()
}() }()
@ -349,7 +349,7 @@ func (peer *Peer) RoutineNonce() {
} }
peer.routines.starting.Done() peer.routines.starting.Done()
logDebug.Println(peer, ": Routine: nonce worker - started") logDebug.Println(peer, "- Routine: nonce worker - started")
for { for {
NextPacket: NextPacket:
@ -394,11 +394,11 @@ func (peer *Peer) RoutineNonce() {
// wait for key to be established // wait for key to be established
logDebug.Println(peer, ": Awaiting keypair") logDebug.Println(peer, "- Awaiting keypair")
select { select {
case <-peer.signals.newKeypairArrived: case <-peer.signals.newKeypairArrived:
logDebug.Println(peer, ": Obtained awaited keypair") logDebug.Println(peer, "- Obtained awaited keypair")
case <-peer.signals.flushNonceQueue: case <-peer.signals.flushNonceQueue:
flush() flush()
@ -521,11 +521,11 @@ func (peer *Peer) RoutineSequentialSender() {
logDebug := device.log.Debug logDebug := device.log.Debug
defer func() { defer func() {
logDebug.Println(peer, ": Routine: sequential sender - stopped") logDebug.Println(peer, "- Routine: sequential sender - stopped")
peer.routines.stopping.Done() peer.routines.stopping.Done()
}() }()
logDebug.Println(peer, ": Routine: sequential sender - started") logDebug.Println(peer, "- Routine: sequential sender - started")
peer.routines.starting.Done() peer.routines.starting.Done()