Skip to content

Commit 891c58a

Browse files
Fix build and align networking tests
1 parent bcaaa44 commit 891c58a

7 files changed

Lines changed: 243 additions & 542 deletions

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ require github.com/klauspost/reedsolomon v1.12.5
66

77
require (
88
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
9+
google.golang.org/protobuf v1.36.10
910
golang.org/x/sys v0.37.0 // indirect
1011
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ github.com/klauspost/reedsolomon v1.12.5 h1:4cJuyH926If33BeDgiZpI5OU0pE+wUHZvMSy
44
github.com/klauspost/reedsolomon v1.12.5/go.mod h1:LkXRjLYGM8K/iQfujYnaPeDmhZLqkrGUyG9p7zs5L68=
55
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
66
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
7+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
8+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=

internal/cli/CLI.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func joinNetwork(serverAddr string) {
267267
if err := mapToStruct(resp.Data, &cmdResp); err != nil {
268268
exitOnErr(err, "Error parsing response.")
269269
}
270-
message := fmt.Sprintf("\nJoined network successfully.\n- Connected to %d peers.\n")
270+
message := fmt.Sprintf("\nJoined network successfully.\n- Connected to %d peers.\n", 0)
271271
fmt.Println(message)
272272
}
273273

internal/daemon/handlers/joinNetwork.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os/signal"
99
"syscall"
1010

11+
"github.com/hcp-uw/mosaic/internal/api"
1112
"github.com/hcp-uw/mosaic/internal/cli/protocol"
1213
"github.com/hcp-uw/mosaic/internal/p2p"
1314
)
@@ -76,7 +77,8 @@ func runClient(serverAddr string) {
7677
for scanner.Scan() {
7778
text := scanner.Text()
7879
if client.IsPeerCommunicationAvailable() {
79-
if err := client.SendToAllPeers([]byte(text)); err != nil {
80+
msg := api.NewPeerTextMessage(text, client.GetID())
81+
if err := client.SendToAllPeers(msg); err != nil {
8082
fmt.Printf("[Error] Failed to send message: %v\n", err)
8183
}
8284
} else {

0 commit comments

Comments
 (0)