Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Make handleStreamingMessage unexported
Browse files Browse the repository at this point in the history
- change for loop semantics in (*StreamingConnectionManager).Run

Signed-off-by: Michael Stergianis <michaelstergianis@gmail.com>
  • Loading branch information
Michael Stergianis authored and MichaelStergianis committed Mar 17, 2021
1 parent f918ff7 commit b57f775
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions internal/api/streaming_connection_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,10 @@ func (m *StreamingConnectionManager) Clients() []StreamingClient {

// Run runs the manager. It manages multiple websocket clients.
func (m *StreamingConnectionManager) Run(ctx context.Context) {
done := false
for !done {
for {
select {
case <-ctx.Done():
done = true
return
case meta := <-m.register:
m.clients[meta.client] = meta.cancelFunc
case client := <-m.unregister:
Expand Down
4 changes: 2 additions & 2 deletions internal/api/websocket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ func (c *WebsocketClient) readPump() {
continue
}

if err := HandleStreamingMessage(c, request); err != nil {
if err := handleStreamingMessage(c, request); err != nil {
c.logger.WithErr(err).Errorf("Handle websocket message")
}
}

close(c.stopCh)
}

func HandleStreamingMessage(client StreamingClient, request StreamRequest) error {
func handleStreamingMessage(client StreamingClient, request StreamRequest) error {
handlers, ok := client.Handlers()[request.Type]
if !ok {
return handleUnknownRequest(client, request)
Expand Down

0 comments on commit b57f775

Please sign in to comment.