Skip to content

Commit

Permalink
Adapt ABORT message to comply with spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jschmid authored and gammazero committed Nov 28, 2021
1 parent 775c9a8 commit 3b49522
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ func handleCRAuth(peer wamp.Peer, challenge *wamp.Challenge, authHandlers map[st
// If router sent back ABORT in response to client's authentication attempt
// return error.
if abort, ok := msg.(*wamp.Abort); ok {
authErr, _ := wamp.AsString(abort.Details[wamp.OptError])
authErr, _ := wamp.AsString(abort.Details[wamp.OptMessage])
if authErr == "" {
authErr = "authentication failed"
}
Expand Down
2 changes: 1 addition & 1 deletion router/realm.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (r *realm) handleSession(sess *wamp.Session) error {
if err != nil {
abortMsg := wamp.Abort{
Reason: wamp.ErrProtocolViolation,
Details: wamp.Dict{"error": err.Error()},
Details: wamp.Dict{wamp.OptMessage: err.Error()},
}
r.log.Println("Aborting session", sess, ":", err)
sess.TrySend(&abortMsg)
Expand Down
2 changes: 1 addition & 1 deletion router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (r *router) AttachClient(client wamp.Peer, transportDetails wamp.Dict) erro
abortMsg := wamp.Abort{Reason: reason}
abortMsg.Details = wamp.Dict{}
if abortErr != nil {
abortMsg.Details["error"] = abortErr.Error()
abortMsg.Details[wamp.OptMessage] = abortErr.Error()
r.log.Println("Aborting client connection:", abortErr)
}
client.Send(&abortMsg) // Blocking OK; this is session goroutine.
Expand Down
2 changes: 1 addition & 1 deletion wamp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const (
OptAcknowledge = "acknowledge"
OptDiscloseCaller = "disclose_caller"
OptDiscloseMe = "disclose_me"
OptError = "error"
OptExcludeMe = "exclude_me"
OptInvoke = "invoke"
OptMatch = "match"
OptMessage = "message"
OptMode = "mode"
OptProcedure = "procedure"
OptProgress = "progress"
Expand Down

0 comments on commit 3b49522

Please sign in to comment.