close connection after disconnect
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m54s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m54s
This commit is contained in:
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -46,7 +45,6 @@ func (g *RemoteGrain) Connect() error {
|
|||||||
if !strings.Contains(addr, ":") {
|
if !strings.Contains(addr, ":") {
|
||||||
addr = fmt.Sprintf("%s:1337", addr)
|
addr = fmt.Sprintf("%s:1337", addr)
|
||||||
}
|
}
|
||||||
log.Printf("Connecting to %s %s", addr, g.Address)
|
|
||||||
client, err := net.Dial("tcp", addr)
|
client, err := net.Dial("tcp", addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -198,11 +198,13 @@ type PacketQueue struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewPacketQueue(connection net.Conn) *PacketQueue {
|
func NewPacketQueue(connection net.Conn) *PacketQueue {
|
||||||
|
|
||||||
queue := &PacketQueue{
|
queue := &PacketQueue{
|
||||||
Packets: make([]PacketWithData, 0),
|
Packets: make([]PacketWithData, 0),
|
||||||
connection: connection,
|
connection: connection,
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
|
defer connection.Close()
|
||||||
for {
|
for {
|
||||||
messageType, data, err := ReceivePacket(queue.connection)
|
messageType, data, err := ReceivePacket(queue.connection)
|
||||||
ts := time.Now()
|
ts := time.Now()
|
||||||
|
|||||||
Reference in New Issue
Block a user