Move post-connection ping to after chat list times out
This commit is contained in:
parent
aefe63cba5
commit
7c67fe75eb
23
user.go
23
user.go
@ -455,17 +455,13 @@ func (user *User) sendMarkdownBridgeAlert(formatString string, args ...interface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (user *User) intPostLogin() {
|
func (user *User) postConnPing() bool {
|
||||||
defer user.syncWait.Done()
|
|
||||||
user.createCommunity()
|
|
||||||
user.tryAutomaticDoublePuppeting()
|
|
||||||
|
|
||||||
err := user.Conn.AdminTest()
|
err := user.Conn.AdminTest()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
user.log.Errorfln("Post-connection ping failed: %v. Disconnecting and then reconnecting after a second", err)
|
user.log.Errorfln("Post-connection ping failed: %v. Disconnecting and then reconnecting after a second", err)
|
||||||
sess, disconnectErr := user.Conn.Disconnect()
|
sess, disconnectErr := user.Conn.Disconnect()
|
||||||
if disconnectErr != nil {
|
if disconnectErr != nil {
|
||||||
user.log.Warnln("Error while disconnecting after failed post-login ping:", disconnectErr)
|
user.log.Warnln("Error while disconnecting after failed post-connection ping:", disconnectErr)
|
||||||
} else {
|
} else {
|
||||||
user.Session = &sess
|
user.Session = &sess
|
||||||
}
|
}
|
||||||
@ -474,16 +470,27 @@ func (user *User) intPostLogin() {
|
|||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
user.tryReconnect(fmt.Sprintf("Post-connection ping failed: %v", err))
|
user.tryReconnect(fmt.Sprintf("Post-connection ping failed: %v", err))
|
||||||
}()
|
}()
|
||||||
return
|
return false
|
||||||
} else {
|
} else {
|
||||||
user.log.Debugln("Post-login ping OK")
|
user.log.Debugln("Post-connection ping OK")
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (user *User) intPostLogin() {
|
||||||
|
defer user.syncWait.Done()
|
||||||
|
user.createCommunity()
|
||||||
|
user.tryAutomaticDoublePuppeting()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-user.chatListReceived:
|
case <-user.chatListReceived:
|
||||||
user.log.Debugln("Chat list receive confirmation received in PostLogin")
|
user.log.Debugln("Chat list receive confirmation received in PostLogin")
|
||||||
case <-time.After(time.Duration(user.bridge.Config.Bridge.ChatListWait) * time.Second):
|
case <-time.After(time.Duration(user.bridge.Config.Bridge.ChatListWait) * time.Second):
|
||||||
user.log.Warnln("Timed out waiting for chat list to arrive!")
|
user.log.Warnln("Timed out waiting for chat list to arrive!")
|
||||||
|
user.postConnPing()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !user.postConnPing() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user