Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return errors in sendOpen function #477

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (ch *Channel) sendOpen(msg message) (err error) {
ChannelId: ch.id,
Method: content,
}); err != nil {
return
return err
}

if err = ch.connection.send(&headerFrame{
Expand All @@ -243,7 +243,7 @@ func (ch *Channel) sendOpen(msg message) (err error) {
Size: uint64(len(body)),
Properties: props,
}); err != nil {
return
return err
}

// chunk body into size (max frame size - frame header size)
Expand All @@ -256,17 +256,20 @@ func (ch *Channel) sendOpen(msg message) (err error) {
ChannelId: ch.id,
Body: body[i:j],
}); err != nil {
return
return err
}
}
} else {
err = ch.connection.send(&methodFrame{
if err = ch.connection.send(&methodFrame{
ChannelId: ch.id,
Method: msg,
})
}); err != nil {
return err
}

}

return
return nil
}

// Eventually called via the state machine from the connection's reader
Expand Down
6 changes: 3 additions & 3 deletions read.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ func (r *reader) ReadFrame() (frame frame, err error) {
switch typ {
case frameMethod:
if frame, err = r.parseMethodFrame(channel, size); err != nil {
return
return nil, err
}

case frameHeader:
if frame, err = r.parseHeaderFrame(channel, size); err != nil {
return
return nil, err
}

case frameBody:
Expand All @@ -72,7 +72,7 @@ func (r *reader) ReadFrame() (frame frame, err error) {

case frameHeartbeat:
if frame, err = r.parseHeartbeatFrame(channel, size); err != nil {
return
return nil, err
}

default:
Expand Down