engineRefine #416
|
@ -157,9 +157,7 @@ func (e *engine) eventHandler() {
|
|||
}
|
||||
go e.peerWithTokenServer(ev.Data[event.GroupServer], ev.Data[event.ServerTokenOnion], ev.Data[event.ServerTokenY], signature)
|
||||
case event.LeaveServer:
|
||||
e.ephemeralServicesLock.Lock()
|
||||
e.leaveServer(ev.Data[event.GroupServer])
|
||||
e.ephemeralServicesLock.Unlock()
|
||||
case event.DeleteContact:
|
||||
onion := ev.Data[event.RemotePeer]
|
||||
// We remove this peer from out blocklist which will prevent them from contacting us if we have "block unknown peers" turned on.
|
||||
|
@ -336,7 +334,7 @@ func (e *engine) peerWithTokenServer(onion string, tokenServerOnion string, toke
|
|||
return
|
||||
}
|
||||
// Otherwise...we are going to rebuild the connection(which will result in a bandwidth heavy resync)...
|
||||
e.leaveServer(onion)
|
||||
connectionService.service.Shutdown()
|
||||
}
|
||||
// Otherwise...let's reconnect
|
||||
}
|
||||
|
@ -634,9 +632,9 @@ func (e *engine) handlePeerRetVal(hostname string, getValData, retValData []byte
|
|||
}
|
||||
|
||||
// leaveServer disconnects from a server and deletes the ephemeral service
|
||||
// REQUIREMENTS: must be called inside a block with e.ephemeralServicesLock.Lock()
|
||||
// can't do it iself because is called from inside peerWithTokenServer which holds the lock
|
||||
func (e *engine) leaveServer(server string) {
|
||||
e.ephemeralServicesLock.Lock()
|
||||
defer e.ephemeralServicesLock.Unlock()
|
||||
ephemeralService, ok := e.ephemeralServices[server]
|
||||
if ok {
|
||||
ephemeralService.service.Shutdown()
|
||||
|
|
Loading…
Reference in New Issue