request peer info token wrong

This commit is contained in:
TenderIronh
2022-06-15 23:20:13 +08:00
parent df23b30d2b
commit 0fb3bc4e26
4 changed files with 5 additions and 4 deletions

View File

@@ -136,6 +136,7 @@ func (pn *P2PNetwork) runAll() {
}
config.nextRetryTime = time.Now().Add(time.Second * time.Duration(increase)) // exponential increase retry time. 1.3^x
config.connectTime = time.Now()
config.peerToken = pn.config.Token
gConf.mtx.Unlock() // AddApp will take a period of time
err := pn.AddApp(*config)
gConf.mtx.Lock()

View File

@@ -33,7 +33,7 @@ type P2PTunnel struct {
func (t *P2PTunnel) requestPeerInfo() error {
// request peer info
t.pn.write(MsgQuery, MsgQueryPeerInfoReq, &QueryPeerInfoReq{t.pn.config.Token, t.config.PeerNode})
t.pn.write(MsgQuery, MsgQueryPeerInfoReq, &QueryPeerInfoReq{t.config.peerToken, t.config.PeerNode})
head, body := t.pn.read("", MsgQuery, MsgQueryPeerInfoRsp, time.Second*10)
if head == nil {
return ErrPeerOffline

View File

@@ -10,7 +10,7 @@ import (
"time"
)
const OpenP2PVersion = "3.1.0"
const OpenP2PVersion = "3.2.0"
const ProducnName string = "openp2p"
const LeastSupportVersion = "3.0.0"
@@ -148,7 +148,7 @@ const (
PublicIPEchoTimeout = time.Second * 1
NatTestTimeout = time.Second * 10
ClientAPITimeout = time.Second * 10
MaxDirectTry = 5
MaxDirectTry = 3
)
// NATNone has public ip

View File

@@ -64,7 +64,7 @@ func Discover() (nat NAT, err error) {
var n int
_, _, err = socket.ReadFromUDP(answerBytes)
if err != nil {
gLog.Println(LvERROR, "UPNP discover error:", err)
gLog.Println(LvDEBUG, "UPNP discover error:", err)
return
}