Closed sigwinch28 closed 4 years ago
Merging #13 into master will decrease coverage by
0.05%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #13 +/- ##
==========================================
- Coverage 99.43% 99.38% -0.06%
==========================================
Files 5 5
Lines 356 324 -32
Branches 57 45 -12
==========================================
- Hits 354 322 -32
Misses 1 1
Partials 1 1
Impacted Files | Coverage Δ | |
---|---|---|
src/wormhole_transit_relay/transit_server.py | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c644532...912cfa6. Read the comment docs.
Oh, this is awesome. Thank you!
This is just a suggestion.
I noticed the handshake logic was quite complicated because the transit server is getting raw data as opposed to lines.
Twisted has a
LineReceiver
protocol which seems to make the job easier: thelineReceived
method will be called by Twisted for each\n
-terminated line which arrives (up to a default maximum length of 16384). As soon as the handshake is complete can callsetRawMode()
which immediately turns off line-based processing and diverts all incoming data to therawDataReceived
method which we can use when we're glued to a buddy connection.All the tests still pass: impatience behaviour is maintained, and bad handshakes are detected unless a newline is never sent to the server.