MPMessagePack
MPMessagePack copied to clipboard
RPC requires framed option?
The checkReadBuffer
function of MPMessagePackClient
willl stop parsing a big message with an error on this line of code:
https://github.com/gabriel/MPMessagePack/blob/261f56afb16af4973189fa28645897cac1101d5c/RPC/MPMessagePackClient.m#L255
This function tries to parse _readBuffer
, which is filled from the stream by portions using a smaller buffer here:
https://github.com/gabriel/MPMessagePack/blob/261f56afb16af4973189fa28645897cac1101d5c/RPC/MPMessagePackClient.m#L215
This happens in 2 cases:
- either the complete message is bigger than the smaller buffer size (4096 bytes)
- or the network is slow to load just a part of the message in one
read
call (let's say your message is 2K, but the network provides only the first 1K in the beginning)
I'd prefer that this RPC client was tolerant to the errors that happen due to the buffer index outrun, and just retried readInputStream in this case.
I think the framed option allows it to know ahead of time how big the message is and in that case will wait for it?
I always use the framed option with the RPC, so it's possible non-framed doesn't work with RPC. I'd probably need to look into it further.