1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-10 21:22:20 +03:00
Commit Graph

237 Commits

Author SHA1 Message Date
Andrii Vasylevskyi
8e785bbfc2 Add -Wextra-semi compiler flag
Summary: Cleaned up extra semicolons for compatibility with other projects enforcing the flag, included flag in build

Reviewed By: lnicco, JunqiWang

Differential Revision: D21794945

fbshipit-source-id: ae2ee637aadeef35a99d89f9b8deaa2e7d636ed7
2020-05-30 07:39:59 -07:00
Konstantin Tsoy
b1cb1d32af Don't use currentWriteOffset as highest ack offset
Summary: Don't use currentWriteOffset as highest ack offset

Reviewed By: yangchi

Differential Revision: D21679541

fbshipit-source-id: de8814aef4959abc2e10402c5d5e294ef03f8b19
2020-05-28 12:48:28 -07:00
Dan Melnic
37add01a38 SendmmsgGSOPacketBatchWriter - try to batch more based on dest addr (map)
Summary: SendmmsgGSOPacketBatchWriter - try to batch more based on dest addr (map)

Reviewed By: mjoras

Differential Revision: D21110682

fbshipit-source-id: 1be2eb26ec33c8256f1d4bbe7e3d6fae19eb7146
2020-05-27 16:15:04 -07:00
Yang Chi
9554a67c73 add a check for Quic inplace writer for the remaining buffer size
Summary:
as title. Instead of checking against the packet size limit, this
leaves a 10 bytes room since we have a bug that writes out packets that's
slightly larger than udpSendPacketLen. Most of such packet will be 1-2 bytes
larger than original packets.

Reviewed By: mjoras

Differential Revision: D21642386

fbshipit-source-id: 6ca68d48828cb7f8ee692e0d5f452f5389a56bfd
2020-05-26 12:47:44 -07:00
Matt Joras
87212cc872 Bail if any callback causes a close.
Summary: As in title. Also explicitly do some copying of values out of the stream manger.

Reviewed By: yangchi

Differential Revision: D21705460

fbshipit-source-id: 2399b8561a2aa3b6d2b64d154f56ceff22c40186
2020-05-24 13:01:52 -07:00
Yang Chi
da3eb41a78 Encode packet header after Quic cloner is sure the packet can be cloned
Summary:
otherwise we keep encoding packet headers and potentially write into
the write buffer without actually generating a packet. It leaves a trail of bad
headers inside the buffer

Reviewed By: mjoras

Differential Revision: D21626733

fbshipit-source-id: 3bdcf6277beccb09b390a590ba2bb0eb8e68e6c1
2020-05-21 13:26:08 -07:00
Yang Chi
8715ddfc44 Move ScopedBufAccessor into quic/common/BufAccessor
Summary: as title

Reviewed By: mjoras

Differential Revision: D21629491

fbshipit-source-id: 31c0b255ad5ada4186bec90d19bc381fde2c29f5
2020-05-21 13:26:07 -07:00
Matt Joras
34901ee92f Discard the connection immediately on failed migration.
Summary: There's no particular reason to wait for the drain period before removing state. By doing this a failed migration will immediately trigger the server to drop state, triggered a stateless reset signal to the client sooner.

Reviewed By: yangchi, lnicco

Differential Revision: D21643179

fbshipit-source-id: a60ca2c92935a3e6ba773d7936c25317733f7b97
2020-05-19 13:24:08 -07:00
Yang Chi
ddf49f4d26 Use MockAsyncUDPSocket for Quic inplace batch writer tests
Summary:
To make sure the  writer maker function actually return the Inplace
writer

Reviewed By: lnicco

Differential Revision: D21613419

fbshipit-source-id: da7e59b43785b13fd91cc1a737db87af7dfb1c8f
2020-05-17 09:57:16 -07:00
Yang Chi
b80fe6bb6f Add mvfst_state_ack_handler into Quic api cmake list
Summary: recently QuicTransportFunctions start to use ack processing code

Reviewed By: lnicco

Differential Revision: D21596419

fbshipit-source-id: 0770fa0f7d741497738c5fb1e2badfa980e395e7
2020-05-15 11:41:49 -07:00
Yang Chi
98d0473d34 Add mvfst_server to QuicBatchWriterTest CMake deps list
Summary:
as title

(Note: this ignores all push blocking failures!)

Reviewed By: lnicco

Differential Revision: D21595158

fbshipit-source-id: f0061d525852a1b0881ebf4c56923faa58ddae08
2020-05-15 09:14:09 -07:00
Yang Chi
5d07a157a8 Adding mvfst_buf_accessor into a few targets CMake dep list
Summary: as title

Reviewed By: mjoras

Differential Revision: D21550572

fbshipit-source-id: 10aa647810e537b47d6de8adba5b3194e62791d2
2020-05-15 07:34:25 -07:00
Yang Chi
7bfeec366a Use QuicInplacePacketBuilder for write path
Summary: as title

Reviewed By: mjoras

Differential Revision: D21211415

fbshipit-source-id: 15814f951adca2eb4ded8228e2d291a9c1514011
2020-05-12 07:04:57 -07:00
Yang Chi
7022459fb0 Quic Inplace batch writer checks either packet size limit or next packet size
Summary: as title

Reviewed By: mjoras

Differential Revision: D21429917

fbshipit-source-id: 5be997bfd75cfab89c3d9289a31b0efab69a80fc
2020-05-12 07:04:56 -07:00
Yang Chi
62d122a0c4 Fallback to write a Ping frame if Quic Probe doesn't write anything
Summary: as title

Reviewed By: mjoras

Differential Revision: D21464423

fbshipit-source-id: 48cec75f6c8ff0be1e41a5d5a6da0fabf064973a
2020-05-10 09:32:05 -07:00
Yang Chi
fd41b0e324 Quic Probing can write frames other than stream frames
Summary:
During PTO, when we try to write new data, we have been limiting to
only stream data and crypto data. This diff adds a few more types of data to
write during probes if they are available: Simple frame, Window updates, Rst
and Blocked frames.

Right now Acks won't be included here.

Reviewed By: mjoras

Differential Revision: D21460861

fbshipit-source-id: d75a296e96375690eee5e609efd7d1b5c103e8da
2020-05-10 09:32:05 -07:00
Matt Joras
b7389426dc Move retransmission buffer CHECK
Summary: This is just in wrong place. There can be multiple frames per packet that we may be implicitly ACKing.

Reviewed By: lnicco

Differential Revision: D21493553

fbshipit-source-id: 89befab01c5a27d400089478717110bca8137d99
2020-05-09 23:26:40 -07:00
Matt Joras
19dae4b3a0 Clear loss buffer on handshake done.
Summary: Without doing this the loss buffer can potentially carry data indefinitely.

Reviewed By: yangchi

Differential Revision: D21484470

fbshipit-source-id: 85ac9f274c9badb51eb431b85f67a654c399a018
2020-05-09 17:19:42 -07:00
Yang Chi
7bb0dddf34 Check cipher presence before decide to fire write looper for crypto
Summary: they now can be dropped

Reviewed By: mjoras

Differential Revision: D21476334

fbshipit-source-id: 646b993573fea460b0cd967bdb312cd849ac35d3
2020-05-08 16:17:44 -07:00
Yang Chi
46b9fb69f4 Skip a packet number for Quic probe packets
Summary: to elicit acks

Reviewed By: mjoras

Differential Revision: D21309835

fbshipit-source-id: fd56de66c806d5e03292298c79eab49014291b75
2020-05-08 11:41:04 -07:00
Yang Chi
b0cb27110b Set ciphere overhead in the packet builder used by Quic cloner
Summary: as title

Reviewed By: mjoras

Differential Revision: D21383829

fbshipit-source-id: 181085f1f1208ce45579e40c0a0cab28e0bc4aed
2020-05-07 10:56:27 -07:00
Yang Chi
cd7339e454 Give caller some control over if writeStreamFrameHeader should write length
Summary:
Becuase when we clone an existing packet, the logic inside the current
writetStreamFrameHeader is no longer correct.

Reviewed By: mjoras

Differential Revision: D21383828

fbshipit-source-id: 8e6bbb048eefd97ca7cf17b89edc2f395f274a73
2020-05-07 10:56:26 -07:00
Matt Joras
817dd790b7 Min of idle timeouts.
Summary: The spec suggests doing this, and it is a better semantic than only considering the local one.

Reviewed By: yangchi

Differential Revision: D21433433

fbshipit-source-id: c38abc04810eb8807597991ce8801d81f9edc462
2020-05-06 16:24:55 -07:00
Matt Joras
50d5c29346 Cipher dropping take 2
Summary:
Now we won't have a zero PTO and we will properly clear out the outstanding packets.

Note that this cipher dropping is not what the draft prescribes, instead dropping both the initial and handshake ciphers when we know 1-rtt communication is functioning.

Reviewed By: yangchi

Differential Revision: D20388737

fbshipit-source-id: 0b89eb80c8faa796ab09eda3eaa10a00dcf7bae9
2020-05-06 11:14:20 -07:00
Yang Chi
014d50aa41 Quic socket write for the inplace buffer writing
Summary: as title

Reviewed By: mjoras

Differential Revision: D21211414

fbshipit-source-id: 5c4b8a747457e3f21da77541a35da1af1b1ac6e4
2020-05-05 09:53:07 -07:00
Yang Chi
676f315875 Move isNetworkUnreachable out of IoBufQuicBatch to be a free function
Summary:
It doesn't depend on the state of the IOBufQuicBatch. Move it out so
other writers can  use this function in the future

Reviewed By: mjoras

Differential Revision: D21005960

fbshipit-source-id: b09f41f715a7908f74e490ca24eaec0e41f58a2c
2020-04-29 20:37:00 -07:00
Yang Chi
c653133f93 Remove setContinueOnNetworkUnreachable API from IoBufQuicBatch
Summary: this API isn't necessary

Reviewed By: mjoras

Differential Revision: D21005961

fbshipit-source-id: e1be324102b3f9ff2a2d7ef2228711dea3119ebc
2020-04-29 20:37:00 -07:00
Yang Chi
6f71c2dda6 Quic CloningScheduler uses the correct packet builder to clone old packets
Summary: as title

Reviewed By: mjoras

Differential Revision: D20919831

fbshipit-source-id: 76e264780515bb98c32886d75dedd7902958e71e
2020-04-29 20:36:59 -07:00
Yang Chi
64efb370af Fix Quic Ping testcases
Summary:
as title

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D21303116

fbshipit-source-id: 5e76e02a618a5f79867adae0a78e0174630ce039
2020-04-29 09:02:34 -07:00
Yang Chi
2a1529068d Move Quic packet header encoding out of builder constructor
Summary:
Currently the packet builder contructor will encode the packet
builder. This is fine when the builder creates its own output buffer. If later
on we decides not to use this builder, or it fails to build packet, the buffer
will be thrown away. But once the builder uses a buffer provided by caller, and
will be reused, we can no longer just throw it away if we decide not to use
this builder. So we have to delay the header encoding until we know we will use
the builder.

This is still not enough to solve the case where we want to use this builder,
it builds, then it fails . For that, we will need to retreat the tail position
of the IOBuf.

Reviewed By: mjoras

Differential Revision: D21000658

fbshipit-source-id: 4d758b3e260463b17c870618ba68bd4b898a7d4c
2020-04-28 22:14:21 -07:00
Yang Chi
081b63ffce Give QuicServerWorker an output buffer for GSO write with continuous memory
Summary: as title

Reviewed By: mjoras

Differential Revision: D20919833

fbshipit-source-id: 8cd9674d7bccf115cbdac5b976ba70e5dcb70e14
2020-04-28 22:14:20 -07:00
Carmi Grushko
cf729dbafb Don't schedule a PING timeout if callback is nullptr or timeout is 0
Reviewed By: yangchi

Differential Revision: D21249143

fbshipit-source-id: 690abd63272aa666caa7ebc5f3d41f49376281f1
2020-04-28 19:31:48 -07:00
James Donald
2ac4c48e96 Avoid more direct usage of [[nodiscard]] in C++14 mode
Summary:
In D20494128 we fixed the direct use of `[[nodiscard]]` in quic, but more cases have apparently gotten into the codebase since. The reason we don't see more errors in fbsource is that clang is lenient allowing this in `-std=c++14` mode, but it causes a mismatch when the flag is honored for MSVC.

Note: quic and other parts of xplat need to stay in `-std=c++14`  mode for the time being. See abandoned diff D20377630 for details on the last attempt to switch to `-std=c++17`.

Reviewed By: yangchi

Differential Revision: D21280601

fbshipit-source-id: 78a1956d644f5f95d892b1fd82c5e899823c8e84
2020-04-28 16:30:51 -07:00
Dan Melnic
55443f2b16 Add support for thread local batch writers
Summary: Add support for thread local batch writers

Reviewed By: mjoras

Differential Revision: D21004810

fbshipit-source-id: 907a25f95afeab78fdc7e83cbab87b4f51adc3d3
2020-04-23 18:39:09 -07:00
Dan Melnic
6c72a05cd5 Let AsyncUDPSocket send to multiple addresses
Summary:
Add support for variable number of addrs so we can send data to multiple destinations.

(Note: this ignores all push blocking failures!)

Reviewed By: kevin-vigor

Differential Revision: D21032857

fbshipit-source-id: f73b98d44f5d7d92f3692dfddb9b1c76ebcc51c5
2020-04-23 10:51:04 -07:00
Matt Joras
524bf84c44 Implement an explicit inplace encrypt in Aead.
Summary: This is useful when you want to ensure that the IOBuf you pass in is encrypted inplace, as opposed to potentially creating a new one.

Reviewed By: yangchi

Differential Revision: D21135253

fbshipit-source-id: 89b6e718fc8da1324685c390c721a564bb77d01d
2020-04-21 21:43:59 -07:00
Yang Chi
8db6fc263f Do not accept very small cwnd in Quic
Summary: it's a crime

Reviewed By: mjoras

Differential Revision: D21104571

fbshipit-source-id: 122460f4f29c6abe30dd279fb050d1a263eb67a0
2020-04-18 10:45:50 -07:00
Yang Chi
f86e22cb98 Quic Padding one more try
Summary:
Move the Initial padding code into main scheduler so that ack packets
in Initial space will also be padded.

Reviewed By: mjoras

Differential Revision: D21090338

fbshipit-source-id: dd92c2a1c4d00c58bf2470e2b070c43881a70187
2020-04-17 11:52:49 -07:00
Matt Joras
93844d05fa Optionally write one stream frame per packet.
Summary: It may be desirable for some applications to limit the number of streams written to a single packet, for example if they are treating streams like individual messages.

Reviewed By: yangchi

Differential Revision: D21067175

fbshipit-source-id: 75edcb1051bf7f1eb2c9b730806350f9857eabec
2020-04-16 13:17:05 -07:00
Yang Chi
86b7ce35b4 Pad all server initial packets
Summary: as title

Reviewed By: mjoras

Differential Revision: D21042497

fbshipit-source-id: a05d470f979b33770427e8d7c4e55c9858e93d50
2020-04-15 12:40:02 -07:00
Matt Joras
68d6d9203a Stream manager and QuicTransportBase stream API cleanups.
Summary:
Some of these are relevant to performance, others are just cleanups of the API usage.

The performance diffs are generally eschewing multiple lookups into the underlying structures, by reusing the iterator from `find`.

The cleanups are mostly getting rid of checks against `getStream`, which cannot return `nullptr`.

Reviewed By: yangchi

Differential Revision: D20987998

fbshipit-source-id: 1b95fd8b14da934fc921527aa858dcebf80ec8e9
2020-04-13 10:21:45 -07:00
Yang Chi
d2e7e16c31 Short-circuit peek looper if there is no peek callback
Summary:
We always add stuff into peekable streams set since everything with a
read buffer is peekable. This makes the this set potentially big, and the
find_if quite expensive. For apps that isn't interested in peeking,  this is a
waste of time.

Reviewed By: mjoras, lnicco

Differential Revision: D20972192

fbshipit-source-id: d696ded936140c622e019d608c72a646df405111
2020-04-11 12:49:40 -07:00
Luca Niccolini
5ca21a5278 rename infoCallback to statsCallback
Summary:
```
find ./quic | xargs -I{} sed -i "s/infoCallback/statsCallback/g" {}
find ./quic | xargs -I{} sed -i "s/InfoCallback/StatsCallback/g" {}
```

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D20860675

fbshipit-source-id: 4fe99a375b5983da51b6727d7f40788f89083ab3
2020-04-11 11:16:51 -07:00
Yang Chi
726da8cbf7 Use BufQueue for Quic crypto frame writing as well
Summary:
Other frames have been using the BufQueue version of frame writing.
Change this for Crypto streams as well

Reviewed By: mjoras

Differential Revision: D20947921

fbshipit-source-id: 1cfa0f3806e8d74e8c8a4864498e1c06b55d5292
2020-04-10 09:16:16 -07:00
Yang Chi
74f16776f1 Remove CryptoStreamScheduler::scheduleFramesForPacket API
Summary:
Now all the schdulings are via main FrameScheduler or
CloningScheduler, this API is no longer used anywhere.

Reviewed By: mjoras

Differential Revision: D20899649

fbshipit-source-id: 89b34c6e8178a3abad10c594b24feae8308e3768
2020-04-10 09:16:15 -07:00
Yang Chi
e5f26c960e Replace RegularQuicPacketBuilder with PacketBuilderInterface in the frame
Summary: as title

Reviewed By: mjoras

Differential Revision: D20899342

fbshipit-source-id: 3af89de5350f171c575fe4e7385f3014b95357a5
2020-04-10 09:16:15 -07:00
Yang Chi
7d52f280f8 Quic Refactor to move Build->Schedule->Encrypt operation into a functor
Summary:
To prepare for another configuration of this chain. With this, now we
can land all the outstanding GSO optimization diffs without having to worry
about breaking the production code.

Reviewed By: mjoras

Differential Revision: D20838453

fbshipit-source-id: 807a0c546305864e0d70f8989f31d3de3b812278
2020-04-10 09:16:14 -07:00
Matt Joras
49d552c3f4 Store unique_ptr<StreamBuffer> in retransmissionBuffer.
Summary:
As it turns out, the extra indirection from storing a unique_ptr is not worse than the gain from using an `F14ValueMap` versus an `F14VectorMap`.

This reduces the `find` cost measurably in profiles, and doesn't appear to have any real negative effects otherwise.

Reviewed By: yangchi

Differential Revision: D20923854

fbshipit-source-id: a75c4649ea3dbf0e6c89ebfe0d31d082bbdc31fd
2020-04-08 14:35:16 -07:00
Amaury Séchet
fb0b6b1cc4 Move fizz specific part of the client in quic/fizz/client (#120)
Summary:
This create a separate library for the fizz client. This allows complete separation of the fizz part of the client, and make it swapable for something else.

Depends on https://github.com/facebookincubator/mvfst/issues/118
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/120

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

 ---
## Proxygen Canary
Traffic Canary: https://our.intern.facebook.com/intern/traffic/canary?fbid=528194164778784
* elb.prod.muc2c01 - binary - 2020-04-05 14:59 - https://fburl.com/dyndash/ywntlz9n
* flb.prod.fceb2c02 - binary - 2020-04-05 14:59 - https://fburl.com/dyndash/ns1vzm1j
* olb.prod.ratn0c01.p2 - binary - 2020-04-05 14:59 - https://fburl.com/dyndash/0vxebqop
* slb.prod_regional.rnao0c00 - binary - 2020-04-05 14:59 - https://fburl.com/dyndash/a8syav0w
* slb.regional.rvll0c01.p2 - binary - 2020-04-05 14:59 - https://fburl.com/dyndash/igneyshj
 ---

Reviewed By: mjoras

Differential Revision: D20769060

Pulled By: yangchi

fbshipit-source-id: ad5d66c23b3a9723ad3f8c8091981df99339761e
2020-04-06 11:43:31 -07:00
Matt Joras
aa4229f6a6 Reuse iterator when erasing callbacks.
Summary: Doing an extra lookup here is wasteful.

Reviewed By: yangchi, lnicco

Differential Revision: D20848227

fbshipit-source-id: 8a1fee28597fae3cf1ac284a1bd781936ddff931
2020-04-06 10:15:01 -07:00