Update MaxMessageLength behavior#32
Update MaxMessageLength behavior#32ltpquang wants to merge 4 commits intozach-klippenstein:masterfrom
Conversation
|
@zach-klippenstein hi there any progress on this? |
wire/conn.go
Outdated
| // The official implementation of adb imposes an undocumented 255-byte limit | ||
| // on messages. | ||
| MaxMessageLength = 255 | ||
| MaxMessageLength = 1024 * 1024 |
There was a problem hiding this comment.
Given the above comment, there should also be an explanation where this number comes from.
There was a problem hiding this comment.
Good point, I've just updated the comment. Also, I renamed MaxMessageLength to MaxPayloadSize for better reflecting adb's implementation.
wire/sender.go
Outdated
|
|
||
| func (s *realSender) SendMessage(msg []byte) error { | ||
| if len(msg) > MaxMessageLength { | ||
| if len(msg) > MaxMessageLength - 4 { |
There was a problem hiding this comment.
A message's payload is combined from:
- 4-byte hex string denoting message's length
- The message itself
The ADB's implementation implies that the MaxPayloadSize is the size of the message AND the length-string:
MaxPayloadSize = MessageLenghtStringSize + MaxMessageLength
Therefore we need to minus 4 bytes (length-string) to get the message's size.
|
Hi @zach-klippenstein any update on this PR? |
|
please merge this pr. trunked response:
|
|
still is not merged? |
|
why not merged? |
|
Looking forward to this PR being merged |
This PR intends to update
goadb's behaviors regarding to message length. So that:MaxMessageLengthand length-checking logics to reflect current adb's implementationThis fixed #31, and (hopefully) #26 #29.
Please take a look @zach-klippenstein. Thanks!