Skip to content

Commit

Permalink
added system shutdown stream error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ortuman committed May 29, 2018
1 parent 0beedee commit 04f440f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ var (
// ErrResourceConstraint represents 'resource-constraint' stream error.
ErrResourceConstraint = newStreamError("resource-constraint")

// ErrSystemShutdown represents 'system-shutdown' stream error.
ErrSystemShutdown = newStreamError("system-shutdown")

// ErrInternalServerError represents 'internal-server-error' stream error.
ErrInternalServerError = newStreamError("internal-server-error")
)
Expand Down
3 changes: 2 additions & 1 deletion router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sync"
"sync/atomic"

"github.com/ortuman/jackal/errors"
"github.com/ortuman/jackal/log"
"github.com/ortuman/jackal/storage"
"github.com/ortuman/jackal/stream"
Expand Down Expand Up @@ -102,7 +103,7 @@ func Shutdown() {
for _, stm := range inst.streams {
wg.Add(1)
go func(s stream.C2S) {
s.Disconnect(nil)
s.Disconnect(streamerror.ErrSystemShutdown)
wg.Done()
}(stm)
}
Expand Down

0 comments on commit 04f440f

Please sign in to comment.