mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-04-18 17:24:03 +03:00
Eliminate usage of folly::io::Appender [1/n]
Summary: When we're writing to a single continuous section of memory (e.g. one created by the `folly::IOBuf` constructor or `folly::IOBuf::create`), we can just use our `BufWriter` from `quic/common/BufUtil.h` instead of using `folly::io::Appender`. Reviewed By: hanidamlaj Differential Revision: D72475517 fbshipit-source-id: 2d7b23bf1dbdacb2fb70eb9369419bd23770434c
This commit is contained in:
parent
a5f918c4c9
commit
28b13b22d8
@ -327,13 +327,8 @@ StreamTypeField StreamTypeField::Builder::build() {
|
||||
* associated data during aead encryption/decryption.
|
||||
*/
|
||||
Buf QuicAddrValidationToken::getPlaintextToken() const {
|
||||
auto buf = std::make_unique<folly::IOBuf>();
|
||||
folly::io::Appender appender(buf.get(), sizeof(uint64_t));
|
||||
|
||||
// Write the timestamp
|
||||
appender.writeBE<uint64_t>(timestampInMs);
|
||||
|
||||
return buf;
|
||||
auto ts = folly::Endian::big(timestampInMs);
|
||||
return folly::IOBuf::copyBuffer(&ts, sizeof(ts));
|
||||
}
|
||||
|
||||
Buf RetryToken::genAeadAssocData() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user