Bug on Format date
This commit is contained in:
parent
d766e3a7c3
commit
1d3620845d
@ -40,25 +40,31 @@ func (p *PeerCache) checkPeerStatus(peerID string, caller *tools.HTTPCaller) boo
|
||||
if code != 200 {
|
||||
return false
|
||||
}
|
||||
url := res.(*Peer).Url
|
||||
if strings.Contains(url, "localhost") || strings.Contains(url, "127.0.0.1") {
|
||||
url = strings.ReplaceAll(url, "localhost", utils.PEER.API())
|
||||
url = strings.ReplaceAll(url, "127.0.0.1", utils.PEER.API())
|
||||
}
|
||||
methods := caller.URLS[utils.PEER.String()]
|
||||
fmt.Println("checkPeerStatus AFT 3", url, methods)
|
||||
fmt.Println("checkPeerStatus AFT 3", methods)
|
||||
|
||||
if methods == nil {
|
||||
return false
|
||||
}
|
||||
meth := methods[tools.POST]
|
||||
fmt.Println("checkPeerStatus AFT 4", meth)
|
||||
|
||||
if meth == "" {
|
||||
return false
|
||||
}
|
||||
state := api.CheckRemotePeer(url + meth)
|
||||
fmt.Println("checkPeerStatus AFT 4", state)
|
||||
url := res.(*Peer).Url + meth
|
||||
if strings.Contains(url, "localhost") || strings.Contains(url, "127.0.0.1") {
|
||||
url = strings.ReplaceAll(url, "localhost", utils.PEER.API())
|
||||
url = strings.ReplaceAll(url, "127.0.0.1", utils.PEER.API())
|
||||
r := regexp.MustCompile("(:[0-9]+)")
|
||||
ttt := r.FindAllString(url, -1)
|
||||
for _, t := range ttt {
|
||||
url = strings.Replace(url, t, ":8080", -1)
|
||||
}
|
||||
r.ReplaceAllString(url, ":8080")
|
||||
}
|
||||
fmt.Println("checkPeerStatus AFT 4", url)
|
||||
state := api.CheckRemotePeer(url)
|
||||
fmt.Println("checkPeerStatus AFT 4", state, tools.DEAD)
|
||||
|
||||
return state != tools.DEAD
|
||||
}
|
||||
@ -91,7 +97,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, isMySelf bool, dataID str
|
||||
return nil, errors.New("no path found")
|
||||
}
|
||||
if !p.checkPeerStatus(peerID, caller) {
|
||||
return nil, err
|
||||
return nil, errors.New("peer is not reachable")
|
||||
}
|
||||
if method == tools.POST {
|
||||
b, err = caller.CallPost(url, methods[method], body)
|
||||
|
Loading…
Reference in New Issue
Block a user