summaryrefslogtreecommitdiff
path: root/internal/client/tcpclient.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client/tcpclient.go')
-rw-r--r--internal/client/tcpclient.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/client/tcpclient.go b/internal/client/tcpclient.go
index 58004c7..83cb3b6 100644
--- a/internal/client/tcpclient.go
+++ b/internal/client/tcpclient.go
@@ -6,10 +6,11 @@ import (
"io/ioutil"
"log"
"net"
- "strings"
+
+ "codeberg.org/snonux/gorum/internal/vote"
)
-func tcpClientRun(ctx context.Context, node string, ch <-chan []string) error {
+func tcpClientRun(ctx context.Context, node string, ch <-chan vote.Vote) error {
conn, err := net.Dial("tcp", node)
if err != nil {
return err
@@ -22,7 +23,11 @@ func tcpClientRun(ctx context.Context, node string, ch <-chan []string) error {
return fmt.Errorf("channel closed - breaking tcpClientRun loop")
}
- message := strings.Join(votes, " ")
+ message, err := votes.ToJSON()
+ if err != nil {
+ return err
+ }
+
log.Println("tcpclient: sending", message, "to node", node)
_, err = conn.Write([]byte(message))
if err != nil {