Fix: minor bugfix
This commit is contained in:
@@ -3,6 +3,7 @@ package stages
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -117,6 +118,9 @@ type clientScanMsg time.Time
|
||||
func (m *LobbyModel) clientScan() tea.Cmd {
|
||||
return tea.Tick(REFRESH_TIME, func(t time.Time) tea.Msg {
|
||||
m.endpoints, m.err = utils.Ping(viper.GetStringSlice("udp-endpoints"))
|
||||
sort.Slice(m.endpoints, func(i, j int) bool {
|
||||
return m.endpoints[i] < m.endpoints[j]
|
||||
})
|
||||
return clientScanMsg(t)
|
||||
})
|
||||
}
|
||||
@@ -199,6 +203,7 @@ func (m *LobbyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "N", "n":
|
||||
m.op = lobbyOperationServerWaiting
|
||||
cmds = append(cmds, m.serverSendReply(false))
|
||||
cmds = append(cmds, m.serverListen())
|
||||
}
|
||||
case serverSendReplyMsg:
|
||||
if m.err == nil {
|
||||
@@ -225,6 +230,7 @@ func (m *LobbyModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.Quit
|
||||
} else {
|
||||
m.op = lobbyOperationServerWaiting
|
||||
cmds = append(cmds, m.serverListen())
|
||||
}
|
||||
}
|
||||
case lobbyOperationClientScannning:
|
||||
|
||||
Reference in New Issue
Block a user