From ba4afeb4ee19c24b393ec21d374bdd752651c1a6 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 16 Apr 2025 11:46:04 +0200 Subject: Remove topics on network --- pkg/ui/views/game.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'pkg/ui/views/game.go') diff --git a/pkg/ui/views/game.go b/pkg/ui/views/game.go index 52d8459..5a0972c 100644 --- a/pkg/ui/views/game.go +++ b/pkg/ui/views/game.go @@ -4,8 +4,6 @@ import ( "encoding/json" "fmt" "os" - "strconv" - "strings" "github.com/boozec/rahanna/internal/api/database" "github.com/boozec/rahanna/pkg/ui/multiplayer" @@ -197,21 +195,13 @@ func (m *GameModel) getGame() tea.Cmd { // Establish peer connection if m.peer == "peer-1" { if game.IP2 != "" { - ipParts := strings.Split(game.IP2, ":") - if len(ipParts) == 2 { - remoteIP := ipParts[0] - remotePortInt, _ := strconv.Atoi(ipParts[1]) - go m.network.Server.AddPeer("peer-2", remoteIP, remotePortInt) - } + remote := game.IP2 + go m.network.Server.AddPeer("peer-2", remote) } } else { if game.IP1 != "" { - ipParts := strings.Split(game.IP1, ":") - if len(ipParts) == 2 { - remoteIP := ipParts[0] - remotePortInt, _ := strconv.Atoi(ipParts[1]) - go m.network.Server.AddPeer("peer-1", remoteIP, remotePortInt) - } + remote := game.IP1 + go m.network.Server.AddPeer("peer-1", remote) } } -- cgit v1.2.3-18-g5258