diff --git a/rpc-pool.go b/rpc-pool.go index f2bb1c1..5a73c2d 100644 --- a/rpc-pool.go +++ b/rpc-pool.go @@ -3,7 +3,6 @@ package main import ( "fmt" "io" - "log" "net" "strings" "sync" @@ -46,7 +45,6 @@ func (g *RemoteGrain) Connect() error { if !strings.Contains(addr, ":") { addr = fmt.Sprintf("%s:1337", addr) } - log.Printf("Connecting to %s %s", addr, g.Address) client, err := net.Dial("tcp", addr) if err != nil { return err diff --git a/synced-pool.go b/synced-pool.go index 8a5b9e0..efa7160 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -198,11 +198,13 @@ type PacketQueue struct { } func NewPacketQueue(connection net.Conn) *PacketQueue { + queue := &PacketQueue{ Packets: make([]PacketWithData, 0), connection: connection, } go func() { + defer connection.Close() for { messageType, data, err := ReceivePacket(queue.connection) ts := time.Now()