Simplify by making command streams pointer lists like in proto

This commit is contained in:
Marc Di Luzio 2020-07-21 23:52:14 +01:00
parent f78efd1223
commit 8667f55143
6 changed files with 143 additions and 193 deletions

View file

@ -75,14 +75,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon
inv = append(inv, byte(i.Type))
}
in, qu := s.world.RoverCommands(resp)
var incoming, queued []*roveapi.Command
for i := range in {
incoming = append(incoming, &in[i])
}
for i := range qu {
queued = append(queued, &qu[i])
}
incoming, queued := s.world.RoverCommands(resp)
var logs []*roveapi.Log
for _, log := range rover.Logs {
logs = append(logs, &roveapi.Log{

View file

@ -243,8 +243,8 @@ func InnerMain(command string, args ...string) error {
}
commands = append(commands,
&roveapi.Command{
Command: roveapi.CommandType_broadcast,
Data: &roveapi.Command_Broadcast{Broadcast: []byte(args[i])},
Command: roveapi.CommandType_broadcast,
Broadcast: []byte(args[i]),
},
)
case "broadcast":
@ -256,8 +256,8 @@ func InnerMain(command string, args ...string) error {
}
commands = append(commands,
&roveapi.Command{
Command: roveapi.CommandType_broadcast,
Data: &roveapi.Command_Broadcast{Broadcast: []byte(args[i])},
Command: roveapi.CommandType_broadcast,
Broadcast: []byte(args[i]),
},
)
default: