Skip to content

Commit a1f9c9c

Browse files
committed
Revive advantage protocol
1 parent 516772a commit a1f9c9c

File tree

3 files changed

+342
-65
lines changed

3 files changed

+342
-65
lines changed

cmd/ssl-team-client/main.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func main() {
6060
}
6161

6262
for {
63-
time.Sleep(time.Second)
63+
c.ReplyToChoices()
6464
}
6565
}
6666

@@ -109,6 +109,19 @@ func (c *Client) sendDesiredKeeper(id int32) (accepted bool) {
109109
return c.sendRequest(&request)
110110
}
111111

112+
func (c *Client) ReplyToChoices() {
113+
request := rcon.ControllerToTeam{}
114+
if err := sslconn.ReceiveMessage(c.reader, &request); err != nil {
115+
log.Fatal("Failed receiving controller request: ", err)
116+
}
117+
if request.GetAdvantageChoice() != nil {
118+
log.Printf("Received choice for: %v", *request.GetAdvantageChoice().Foul)
119+
}
120+
reply := rcon.TeamToController_AdvantageResponse_{AdvantageResponse: rcon.TeamToController_CONTINUE}
121+
response := rcon.TeamToController{Msg: &reply}
122+
c.sendRequest(&response)
123+
}
124+
112125
func (c *Client) sendRequest(request *rcon.TeamToController) (accepted bool) {
113126
if privateKey != nil {
114127
request.Signature = &rcon.Signature{Token: &c.token, Pkcs1V15: []byte{}}

0 commit comments

Comments
 (0)