Commit 94e5c7d
committed
transport: call Protocol.connection_made ASAP
It's been observed that in certain real-life scenarios we can start
receiving data via `.pipe_data_received()` before `.subprocess_exec()`
completes. That happens when there are enough async callbacks in flight
that the spawned subprocess starts writing to its stdout before we have
a chance to deliver the result of `.subprocess_exec()`.
This is problematic, because we were deferring calling the
`.connection_made()` of our connected Protocol until after the exec call
returned. This gap made it possible for us to start delivering data to
the Protocol before connecting to it.
Instead of waiting for the async exec call to finish running, call
connection_made() on the Protocol as soon as our own connection_made()
is called. There was really no reason not to do it that way in the
first place — and the assumption that it was equivalent to calling it at
the end of `.connection_made()` proved incorrect.1 parent a9c9538 commit 94e5c7d
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
158 | 157 | | |
159 | | - | |
160 | | - | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
| |||
239 | 236 | | |
240 | 237 | | |
241 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
0 commit comments