-
Notifications
You must be signed in to change notification settings - Fork 42
test against the libp2p transport tests #13
Conversation
quic "github.com/libp2p/go-libp2p-quic-transport" | ||
) | ||
|
||
func TestLibp2pTransportSuite(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I couldn't use ginkgo as I needed a testing.T
.
@Stebalien: I just fixed #9. Can you please rebase this, I'd like to see the CI build pass before merging this? |
deb329d
to
59259c3
Compare
So, it looks like if I close a stream and then close the connection, reading from the stream on the other side will return a
|
The error you'll get depends on the order things are processed. If the stream is read from before the connection is closed, it will return In general, the protocol you describe is inherently racy when run on top of QUIC, since UDP packets can be reordered on the wire. The packet containing the CONNECTION_CLOSE frame can arrive before the packets containing all the stream data are received. The stream will then return the error carried in that frame. The way to fix this by having the peer that is reading the data close the connection once it finished reading. |
So, this is a QUIC issue, not a UDP issue. QUIC could solve this by having close simply mean that no new streams will be opened. When sending a close, an implementation would immediately reset any open streams. When receiving a close, the receiver would also reset any open streams, sending back a close message. Once the last stream has been closed/reset, the connection would be fully closed. To immediately kill the connection, the user would reset it. This can be implemented as a protocol on-top-of QUIC by opening a stream and telling the other side to close the connection once they've all of the streams have been closed. On the other hand, not having a way to gracefully shut-down a connection ASAP in the protocol itself feels like a massive oversight. However, I see that this is simply not how one is supposed to handle QUIC connections. With QUIC, one isn't really supposed to close a connection. Instead, one simply stops using it and lets it go idle. Luckily, this is how libp2p uses connections as well. However, it obviously breaks all of our transport tests... I'll have to fix those. |
Right, that's one way you could do it. Closing of connections was discussed in the QUIC working group, and we came to the conclusion that an orderly shutdown belongs in the application layer, not the transport. There are a lot of ways applications shut down, so the transport itself can only provide the "immediate close" function.
That should work for now. |
e69fafd
to
c6d3bcd
Compare
@marten-seemann could you look into the test failure? quic-go/quic-go#2097. |
0b04194
to
2728c68
Compare
This has been rebased and updated. It should be ready to merge. |
2728c68
to
2c94a6f
Compare
Looks like the tests are stalling, Travis is reporting no output for 10 minutes. |
Damn. It passed locally. |
Unfortunately, I don't have time to keep working on this and it's going to sit here till someone picks it up. @marten-seemann, could you see this through? The transport tests are pretty exhaustive so it would be nice to test quic against them. |
@Stebalien Ok, I'll take it over from here. |
Thanks!
|
-> #93. |
This will fail until #9 is fixed.