summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-06-14 10:01:36 +0300
committerPaul Buetow <paul@buetow.org>2023-06-14 10:01:36 +0300
commit6fe2579b65eaf78573d8b08c94dc1b313c20b9d9 (patch)
treec463eede7deac9a88e1b8722614964cf66bf34b5
parent8259f1a764e0c3543c6770dc91433d85fb2e96db (diff)
more on client/server communication
-rw-r--r--internal/client/tcpclient.go4
-rw-r--r--internal/vote/vote.go2
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