Skip to content

Commit

Permalink
Merge 5d217f5 into d80bb3d
Browse files Browse the repository at this point in the history
  • Loading branch information
ed2k committed Jan 3, 2015
2 parents d80bb3d + 5d217f5 commit bc2a082
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,20 @@ func (info *connInfo) receive() (*MessageIn, error) {
if err != nil {
return nil, err
}
if len(frame) < WaddellHeaderLength {
return nil, fmt.Errorf("Frame not long enough to contain waddell headers. Needed %d bytes, found only %d.", WaddellHeaderLength, len(frame))
if len(frame) < PeerIdLength {
return nil, fmt.Errorf("Frame not long enough to contain waddell headers. Needed %d bytes, found only %d.", PeerIdLength, len(frame))
}
peer, err := readPeerId(frame)
if err != nil {
return nil, err
}
if len(frame) < WaddellHeaderLength {
return &MessageIn{
From: peer,
topic: UnknownTopic,
Body: nil,
}, nil
}
topic, err := readTopicId(frame[PeerIdLength:])
return &MessageIn{
From: peer,
Expand Down

0 comments on commit bc2a082

Please sign in to comment.