Skip to content

Commit df0ac38

Browse files
committed
[bugfix] Fix reference clients (private key not used)
1 parent 7e027a5 commit df0ac38

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cmd/ssl-auto-ref-client/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/RoboCup-SSL/ssl-go-tools/pkg/sslconn"
99
"log"
1010
"net"
11+
"time"
1112
)
1213

1314
var udpAddress = flag.String("udpAddress", "224.5.23.1:10003", "The multicast address of ssl-game-controller")
@@ -26,7 +27,7 @@ type Client struct {
2627
func main() {
2728
flag.Parse()
2829

29-
client.LoadPrivateKey(*privateKeyLocation)
30+
privateKey = client.LoadPrivateKey(*privateKeyLocation)
3031

3132
if *autoDetectAddress {
3233
host := client.DetectHost(*udpAddress)
@@ -47,7 +48,11 @@ func main() {
4748

4849
c.register()
4950
c.sendGameEvent()
50-
c.sendAutoRefMessage("Hello World")
51+
52+
for {
53+
time.Sleep(1 * time.Second)
54+
c.sendAutoRefMessage("Hello World")
55+
}
5156
}
5257

5358
func (c *Client) register() {

cmd/ssl-team-client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type Client struct {
2626
func main() {
2727
flag.Parse()
2828

29-
client.LoadPrivateKey(*privateKeyLocation)
29+
privateKey = client.LoadPrivateKey(*privateKeyLocation)
3030

3131
if *autoDetectAddress {
3232
host := client.DetectHost(*udpAddress)

internal/app/client/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ func SetHost(address string, host string) string {
3636
return host + ":" + parts[1]
3737
}
3838

39-
func LoadPrivateKey(privateKeyLocation string) {
39+
func LoadPrivateKey(privateKeyLocation string) *rsa.PrivateKey {
4040
if privateKeyLocation != "" {
4141
privateKey := ReadPrivateKey(privateKeyLocation)
4242
if privateKey != nil {
4343
log.Print("Found private key")
44+
return privateKey
4445
} else {
4546
log.Print("No private key available")
4647
}
4748
}
49+
return nil
4850
}
4951

5052
func ReadPrivateKey(privateKeyLocation string) *rsa.PrivateKey {

0 commit comments

Comments
 (0)