Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
refactor: lift common code
Browse files Browse the repository at this point in the history
  • Loading branch information
rade committed Jul 20, 2015
1 parent 29977a5 commit e294eac
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions router/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ func (res *ProtocolIntroResults) doIntroV1(params ProtocolIntroParams, pubKey, p
return err
}

res.Sender = NewGobTCPSender(enc)
res.Receiver = NewGobTCPReceiver(dec)

if pubKey == nil {
if _, present := res.Features["PublicKey"]; present {
return ErrExpectedNoCrypto
}

res.Sender = NewGobTCPSender(enc)
res.Receiver = NewGobTCPReceiver(dec)
} else {
remotePubKeyStr, ok := res.Features["PublicKey"]
if !ok {
Expand All @@ -198,8 +198,6 @@ func (res *ProtocolIntroResults) doIntroV1(params ProtocolIntroParams, pubKey, p
return err
}

res.Sender = NewGobTCPSender(enc)
res.Receiver = NewGobTCPReceiver(dec)
res.setupCrypto(params, remotePubKey, privKey)
}

Expand Down

0 comments on commit e294eac

Please sign in to comment.