Skip to content

Commit

Permalink
Merge pull request #118 from Delorus/master
Browse files Browse the repository at this point in the history
fix incorrect header for message id in ACK frames
  • Loading branch information
worg authored Mar 21, 2022
2 parents fd49af8 + fb00437 commit 7b50115
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,10 @@ func (c *Conn) createAckNackFrame(msg *Message, ack bool) (*frame.Frame, error)
return nil, missingHeader(frame.MessageId)
}
case V12:
if ack, ok := msg.Header.Contains(frame.Ack); ok {
if ack, ok := msg.Header.Contains(frame.Id); ok {
f.Header.Add(frame.Id, ack)
} else {
return nil, missingHeader(frame.Ack)
return nil, missingHeader(frame.Id)
}
}

Expand Down
4 changes: 2 additions & 2 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func subscribeHelper(c *C, ackMode AckMode, version Version, opts ...func(*frame
frame.MessageId, messageId,
frame.Destination, destination)
if version == V12 {
f4.Header.Add(frame.Ack, messageId)
f4.Header.Add(frame.Id, messageId)
}
f4.Body = []byte(bodyText)
err = rw.Write(f4)
Expand Down Expand Up @@ -461,7 +461,7 @@ func subscribeTransactionHelper(c *C, ackMode AckMode, version Version, abort bo
frame.MessageId, messageId,
frame.Destination, destination)
if version == V12 {
f4.Header.Add(frame.Ack, messageId)
f4.Header.Add(frame.Id, messageId)
}
f4.Body = []byte(bodyText)
err = rw.Write(f4)
Expand Down
8 changes: 4 additions & 4 deletions server/client/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ func (c *Conn) allocateMessageId(f *frame.Frame, sub *Subscription) {
// if there is any requirement by the client to acknowledge, set
// the ack header as per STOMP 1.2
if sub == nil || sub.ack == frame.AckAuto {
f.Header.Del(frame.Ack)
f.Header.Del(frame.Id)
} else {
f.Header.Set(frame.Ack, messageId)
f.Header.Set(frame.Id, messageId)
}
}
}
Expand Down Expand Up @@ -659,7 +659,7 @@ func (c *Conn) handleAck(f *frame.Frame) error {
var err error
var msgId string

if ack, ok := f.Header.Contains(frame.Ack); ok {
if ack, ok := f.Header.Contains(frame.Id); ok {
msgId = ack
} else if msgId, ok = f.Header.Contains(frame.MessageId); !ok {
return missingHeader(frame.MessageId)
Expand Down Expand Up @@ -702,7 +702,7 @@ func (c *Conn) handleNack(f *frame.Frame) error {
var err error
var msgId string

if ack, ok := f.Header.Contains(frame.Ack); ok {
if ack, ok := f.Header.Contains(frame.Id); ok {
msgId = ack
} else if msgId, ok = f.Header.Contains(frame.MessageId); !ok {
return missingHeader(frame.MessageId)
Expand Down

0 comments on commit 7b50115

Please sign in to comment.