Skip to content

Commit

Permalink
Merge pull request #115 from alfrunes/MEN-4803-1.1.x
Browse files Browse the repository at this point in the history
Cherry-pick MEN-4803 to 1.1.x
  • Loading branch information
tranchitella authored Jun 30, 2021
2 parents d1d4c82 + b6397ae commit afb1de7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions api/http/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func (h DeviceController) Connect(c *gin.Context) {
l.Error(err)
return
}
conn.SetReadLimit(int64(app.MessageSizeLimit))

// websocketWriter is responsible for closing the websocket
//nolint:errcheck
go h.connectWSWriter(ctx, conn, msgChan, errChan)
Expand Down
8 changes: 2 additions & 6 deletions api/http/management.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,9 @@ func (h ManagementController) Connect(c *gin.Context) {
if err != nil {
err = errors.Wrap(err, "unable to upgrade the request to websocket protocol")
l.Error(err)
c.JSON(http.StatusInternalServerError, gin.H{
"error": "internal error",
})
return
}
conn.SetReadLimit(int64(app.MessageSizeLimit))

//nolint:errcheck
h.ConnectServeWS(ctx, conn, session, deviceChan)
Expand Down Expand Up @@ -287,11 +285,9 @@ func (h ManagementController) Playback(c *gin.Context) {
if err != nil {
err = errors.Wrap(err, "unable to upgrade the request to websocket protocol")
l.Error(err)
c.JSON(http.StatusInternalServerError, gin.H{
"error": "internal error",
})
return
}
conn.SetReadLimit(int64(app.MessageSizeLimit))

deviceChan := make(chan *natsio.Msg, channelSize)
errChan := make(chan error, 1)
Expand Down

0 comments on commit afb1de7

Please sign in to comment.