cleanup
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m54s

This commit is contained in:
matst80
2024-11-10 11:13:14 +01:00
parent e9e8a1518f
commit 05a7dc50cf
2 changed files with 19 additions and 19 deletions

View File

@@ -20,11 +20,11 @@ type Quorum interface {
}
type RemoteHost struct {
net.Conn
*PacketQueue
Host string
MissedPings int
Pool *RemoteGrainPool
connection net.Conn
queue *PacketQueue
}
type SyncedPool struct {
@@ -239,7 +239,7 @@ func NewPacketQueue(connection net.Conn) *PacketQueue {
queue.mu.Lock()
for i, packet := range queue.Packets {
if time.Since(packet.Added) < time.Second*5 {
if time.Since(packet.Added) < time.Second {
stillInQueue := queue.Packets[i:]
log.Printf("DEBUG: Requeueing %v packets\n", stillInQueue)
queue.Packets = stillInQueue
@@ -378,7 +378,7 @@ func (h *RemoteHost) Negotiate(knownHosts []string) ([]string, error) {
if err != nil {
return nil, err
}
packet, err := h.queue.Expect(RemoteNegotiate, time.Second)
packet, err := h.Expect(RemoteNegotiate, time.Second)
if err != nil {
return nil, err
@@ -395,7 +395,7 @@ func (g *RemoteHost) GetCartMappings() []CartId {
log.Printf("Error getting mappings: %v\n", err)
return nil
}
packet, err := g.queue.Expect(CartIdsResponse, time.Second*3)
packet, err := g.Expect(CartIdsResponse, time.Second*3)
if err != nil {
log.Printf("Error getting mappings: %v\n", err)
return nil
@@ -434,7 +434,7 @@ func (r *RemoteHost) ConfirmChange(id CartId, host string) error {
if err != nil {
return err
}
_, err = r.queue.Expect(AckChange, time.Second)
_, err = r.Expect(AckChange, time.Second)
if err != nil {
return err
@@ -459,7 +459,7 @@ func DoPing(host *RemoteHost) error {
SendPacket(host.connection, Ping, func(w io.Writer) error {
return nil
})
_, err := host.queue.Expect(Pong, time.Second)
_, err := host.Expect(Pong, time.Second)
if err != nil {
return err
@@ -511,10 +511,10 @@ func (p *SyncedPool) AddRemote(address string) error {
pool := NewRemoteGrainPool(address)
remote := RemoteHost{
connection: connection,
queue: NewPacketQueue(connection),
Pool: pool,
Host: address,
Conn: connection,
PacketQueue: NewPacketQueue(connection),
Pool: pool,
Host: address,
}
return p.addRemoteHost(address, &remote)