Add non-throwing alternative to decodeVarint
authorJon Maltiel Swenson <jmswen@fb.com>
Wed, 31 May 2017 15:20:51 +0000 (08:20 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 31 May 2017 15:35:46 +0000 (08:35 -0700)
commitba9034b9647da166a87ef42583415fbcc8127255
tree6328fc9696fb067346d6c7e767b9aeeffa6539ac
parentda541af34da0e370cb1e1566fb6a93d36747bfc4
Add non-throwing alternative to decodeVarint

Summary:
In mcrouter code, we would like a non-throwing alternative to `decodeVarint()`. There
are real, expected scenarios where only part of a serialized varint fits into a packet,
in which case mcrouter fails to decode the varint and throws.  In these scenarios,
throwing too many exceptions can lead to lock contention and degrade performance.

Reviewed By: yfeldblum

Differential Revision: D5153823

fbshipit-source-id: 138273af832903f0b04bee0bcacddd66b4274129
folly/Varint.h