From 22a80c597848618a6225c788cbf5b89ed2abf7ed Mon Sep 17 00:00:00 2001 From: matst80 Date: Sat, 9 Nov 2024 23:31:02 +0100 Subject: [PATCH] to complex with reused connection --- synced-pool.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/synced-pool.go b/synced-pool.go index b20b317..70b298f 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -108,7 +108,7 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, d Discovery) (*Synced continue } log.Printf("Got connection from %s", conn.RemoteAddr().Network()) - pool.AddRemoteWithConnection(conn.RemoteAddr().Network(), conn) + go pool.handleConnection(conn) } }() @@ -418,17 +418,6 @@ func (p *SyncedPool) OwnerChanged(id CartId, host string) error { return nil } -func (p *SyncedPool) AddRemoteWithConnection(address string, connection net.Conn) error { - pool := NewRemoteGrainPool(fmt.Sprintf(address, 1337)) - remote := RemoteHost{ - connection: connection, - queue: NewPacketQueue(connection), - Pool: pool, - Host: address, - } - return p.addRemoteHost(address, &remote) -} - func DoPing(host *RemoteHost) error { SendPacket(host.connection, Ping, func(w io.Writer) error { return nil