From ca5ccbf7c9785caa966533a3535ca7a67a31b1d2 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Fri, 6 Nov 2020 14:02:44 +0000 Subject: [PATCH] dunno what to do now --- internal/wire/client.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/wire/client.go b/internal/wire/client.go index a419282..8cd7b80 100644 --- a/internal/wire/client.go +++ b/internal/wire/client.go @@ -16,8 +16,7 @@ type Client struct { Host string Port int - lastSeq int - conn *websocket.Conn + conn *websocket.Conn outbox chan *pending resolved chan Response @@ -132,11 +131,10 @@ func (c *Client) readLoop(notifications chan<- Response) { func (c *Client) writeLoop() { sent := make(map[int]*pending) - for { + for seq := 1; true; seq++ { select { case p := <-c.outbox: - c.lastSeq++ - req := Request{c.lastSeq, p.v} + req := Request{seq, p.v} w, err := c.conn.NextWriter(websocket.TextMessage) if err != nil { @@ -161,7 +159,7 @@ func (c *Client) writeLoop() { break } c.Child("write-frame").Info(string(b)) - sent[c.lastSeq] = p + sent[seq] = p case res := <-c.resolved: p, ok := sent[res.Re]