fix: preserve client password during reconnection process
This commit is contained in:
parent
c30829392d
commit
94e7b41421
1 changed files with 6 additions and 0 deletions
|
@ -29,8 +29,14 @@ func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) {
|
||||||
// Try to reconnect on unexpected disconnect
|
// Try to reconnect on unexpected disconnect
|
||||||
for {
|
for {
|
||||||
channel <- prevMessage // send previous ServerMessage to update view
|
channel <- prevMessage // send previous ServerMessage to update view
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
|
// reconnect while preserving password
|
||||||
|
pw := c.Password
|
||||||
*c = Connect(c.Server)
|
*c = Connect(c.Server)
|
||||||
|
c.Password = pw
|
||||||
|
|
||||||
if c.Connected() {
|
if c.Connected() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue