Skip to content

Commit 4ea189a

Browse files
committed
Use multicast_server from ssl-go-tools
1 parent eeb1215 commit 4ea189a

File tree

4 files changed

+12
-154
lines changed

4 files changed

+12
-154
lines changed

Diff for: go.mod

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module github.com/RoboCup-SSL/ssl-status-board
22

33
go 1.21
44

5-
require github.com/gorilla/websocket v1.5.3
6-
7-
require golang.org/x/net v0.34.0 // indirect
5+
require (
6+
github.com/RoboCup-SSL/ssl-go-tools v1.8.1
7+
github.com/gorilla/websocket v1.5.3
8+
)

Diff for: go.sum

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
2-
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
3-
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
4-
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
1+
github.com/RoboCup-SSL/ssl-go-tools v1.8.1 h1:6EAIeJdgr2BO1lfQNrt1vNFFKiKScqjd1HrZsCZ07rg=
2+
github.com/RoboCup-SSL/ssl-go-tools v1.8.1/go.mod h1:FuTw472klW5wAMg09gxQqPCzu6ygxOdMA8D22fDOUfM=
53
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
64
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
7-
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
8-
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
9-
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
10-
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=

Diff for: pkg/board/board.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package board
22

33
import (
44
"fmt"
5-
"github.com/RoboCup-SSL/ssl-status-board/pkg/sslnet"
5+
"github.com/RoboCup-SSL/ssl-go-tools/pkg/sslnet"
66
"github.com/gorilla/websocket"
77
"log"
8+
"net"
89
"net/http"
910
"sync"
1011
"time"
@@ -23,21 +24,22 @@ type Board struct {
2324
func NewBoard(cfg RefereeConfig) (b *Board) {
2425
b = new(Board)
2526
b.cfg = cfg
26-
b.MulticastServer = sslnet.NewMulticastServer(b.handlingMessage)
27+
b.MulticastServer = sslnet.NewMulticastServer(b.cfg.MulticastAddress)
28+
b.MulticastServer.Consumer = b.handlingMessage
2729
return
2830
}
2931

3032
// Start listening for messages
3133
func (b *Board) Start() {
32-
b.MulticastServer.Start(b.cfg.MulticastAddress)
34+
b.MulticastServer.Start()
3335
}
3436

3537
// Stop listening for messages
3638
func (b *Board) Stop() {
3739
b.MulticastServer.Stop()
3840
}
3941

40-
func (b *Board) handlingMessage(data []byte) {
42+
func (b *Board) handlingMessage(data []byte, _ *net.UDPAddr) {
4143
b.mutex.Lock()
4244
defer b.mutex.Unlock()
4345
b.refereeData = data

Diff for: pkg/sslnet/multicast_receiver.go

-139
This file was deleted.

0 commit comments

Comments
 (0)