From 6fe2579b65eaf78573d8b08c94dc1b313c20b9d9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 14 Jun 2023 10:01:36 +0300 Subject: more on client/server communication --- internal/client/tcpclient.go | 4 +++- internal/vote/vote.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/client/tcpclient.go b/internal/client/tcpclient.go index 83cb3b6..f521ee3 100644 --- a/internal/client/tcpclient.go +++ b/internal/client/tcpclient.go @@ -29,7 +29,9 @@ func tcpClientRun(ctx context.Context, node string, ch <-chan vote.Vote) error { } log.Println("tcpclient: sending", message, "to node", node) - _, err = conn.Write([]byte(message)) + + bytes := []byte(fmt.Sprintf("%s\n", message)) + _, err = conn.Write(bytes) if err != nil { return err } diff --git a/internal/vote/vote.go b/internal/vote/vote.go index 91775d0..6fa2510 100644 --- a/internal/vote/vote.go +++ b/internal/vote/vote.go @@ -6,7 +6,7 @@ import ( "time" ) -const Expiry = 10 * time.Second +const Expiry = 11 * time.Second type Vote struct { FromID string -- cgit v1.2.3