fix: preserve client password during reconnection process

This commit is contained in:
Sebastian Mark 2024-11-13 17:12:54 +01:00
parent c30829392d
commit 94e7b41421

View file

@ -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
} }