Skip to content

Commit

Permalink
Use multicast_server from ssl-go-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Feb 23, 2025
1 parent eeb1215 commit 4ea189a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 154 deletions.
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module github.com/RoboCup-SSL/ssl-status-board

go 1.21

require github.com/gorilla/websocket v1.5.3

require golang.org/x/net v0.34.0 // indirect
require (
github.com/RoboCup-SSL/ssl-go-tools v1.8.1
github.com/gorilla/websocket v1.5.3
)
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/RoboCup-SSL/ssl-go-tools v1.8.1 h1:6EAIeJdgr2BO1lfQNrt1vNFFKiKScqjd1HrZsCZ07rg=
github.com/RoboCup-SSL/ssl-go-tools v1.8.1/go.mod h1:FuTw472klW5wAMg09gxQqPCzu6ygxOdMA8D22fDOUfM=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
10 changes: 6 additions & 4 deletions pkg/board/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package board

import (
"fmt"
"github.com/RoboCup-SSL/ssl-status-board/pkg/sslnet"
"github.com/RoboCup-SSL/ssl-go-tools/pkg/sslnet"
"github.com/gorilla/websocket"
"log"
"net"
"net/http"
"sync"
"time"
Expand All @@ -23,21 +24,22 @@ type Board struct {
func NewBoard(cfg RefereeConfig) (b *Board) {
b = new(Board)
b.cfg = cfg
b.MulticastServer = sslnet.NewMulticastServer(b.handlingMessage)
b.MulticastServer = sslnet.NewMulticastServer(b.cfg.MulticastAddress)
b.MulticastServer.Consumer = b.handlingMessage
return
}

// Start listening for messages
func (b *Board) Start() {
b.MulticastServer.Start(b.cfg.MulticastAddress)
b.MulticastServer.Start()
}

// Stop listening for messages
func (b *Board) Stop() {
b.MulticastServer.Stop()
}

func (b *Board) handlingMessage(data []byte) {
func (b *Board) handlingMessage(data []byte, _ *net.UDPAddr) {
b.mutex.Lock()
defer b.mutex.Unlock()
b.refereeData = data
Expand Down
139 changes: 0 additions & 139 deletions pkg/sslnet/multicast_receiver.go

This file was deleted.

0 comments on commit 4ea189a

Please sign in to comment.