Skip to content

Commit

Permalink
Rename MaxMessageLength to MaxPayloadSize to reflect adb's implementa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
ltpquang committed Dec 8, 2020
1 parent 4ca8f45 commit a46e61a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions wire/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package wire
import "github.com/zach-klippenstein/goadb/internal/errors"

const (
// The official implementation of adb imposes an undocumented 255-byte limit
// on messages.
MaxMessageLength = 1024 * 1024
// The official implementation of adb imposes an undocumented 1-megabyte limit
// on payload size.
MaxPayloadSize = 1024 * 1024
)

/*
Expand Down
2 changes: 1 addition & 1 deletion wire/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func SendMessageString(s Sender, msg string) error {
}

func (s *realSender) SendMessage(msg []byte) error {
if len(msg) > MaxMessageLength - 4 {
if len(msg) > MaxPayloadSize- 4 {
return errors.AssertionErrorf("message length exceeds maximum: %d", len(msg))
}

Expand Down

0 comments on commit a46e61a

Please sign in to comment.