reduce waituntilauthenticated delay and add one for psc

This commit is contained in:
erinn 2018-10-10 14:59:38 -07:00
parent 6b98b32156
commit f271638422
2 changed files with 11 additions and 1 deletions

View File

@ -95,7 +95,7 @@ func (ppc *PeerPeerConnection) WaitTilAuthenticated() {
if ppc.GetState() == AUTHENTICATED {
break
}
time.Sleep(time.Second * 5)
time.Sleep(time.Second * 1)
}
}

View File

@ -39,6 +39,16 @@ func (psc *PeerServerConnection) GetState() ConnectionState {
return psc.state
}
// WaitTilAuthenticated waits until the underlying connection is authenticated
func (psc *PeerServerConnection) WaitTilAuthenticated() {
for {
if psc.GetState() == AUTHENTICATED {
break
}
time.Sleep(time.Second * 1)
}
}
// Run manages the setup and teardown of a peer server connection
func (psc *PeerServerConnection) Run() error {
log.Printf("Connecting to %v", psc.Server)