aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-01-22 00:53:13 +0800
committerFelix Lange <fjl@twurst.com>2015-02-06 07:00:35 +0800
commit54252ede3177cb169fbb9e4824a31ce58cb0316c (patch)
tree06e456ef17291ec9f167b51d9fa4f2a840700fdb /p2p/peer.go
parentfaa069a126da29a246193713568634e5be6edd2d (diff)
downloadgo-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar.gz
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar.bz2
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar.lz
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar.xz
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.tar.zst
go-tangerine-54252ede3177cb169fbb9e4824a31ce58cb0316c.zip
add temporary forced session token generation
Diffstat (limited to 'p2p/peer.go')
-rw-r--r--p2p/peer.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index 818f80580..99f1a61d3 100644
--- a/p2p/peer.go
+++ b/p2p/peer.go
@@ -3,6 +3,7 @@ package p2p
import (
"bufio"
"bytes"
+ "crypto/rand"
"fmt"
"io"
"io/ioutil"
@@ -342,6 +343,10 @@ func (p *Peer) handleCryptoHandshake() (loop readLoop, err error) {
// it is survived by an encrypted readwriter
var initiator bool
var sessionToken []byte
+ sessionToken = make([]byte, keyLen)
+ if _, err = rand.Read(sessionToken); err != nil {
+ return
+ }
if p.dialAddr != nil { // this should have its own method Outgoing() bool
initiator = true
}