quinn icon indicating copy to clipboard operation
quinn copied to clipboard

Provide example code for quinn-proto

Open Demi-Marie opened this issue 5 years ago • 10 comments

quinn-proto is difficult to use, and one of the reasons is that there is no example code provided outside of its own test cases.

Demi-Marie avatar Jan 03 '20 20:01 Demi-Marie

What are you trying to do? As we haven't had many people interested in using quinn-proto, it would be interesting to hear more about your use case and what kind of documentation you'd need.

Probably the best way to figure out the quinn-proto API is by looking at the code in quinn, for now.

djc avatar Jan 03 '20 20:01 djc

I am trying to use quinn-proto in libp2p. My current efforts can be found here. It successfully establishes a connection, but fails to open any streams.

Demi-Marie avatar Jan 03 '20 21:01 Demi-Marie

Okay, and do you have any particular issues that you're running into/things you need example code for? I usually find it easier to start from concrete questions or problems. Do you get an error when opening a stream, or does the connection hang?

djc avatar Jan 03 '20 21:01 djc

The connection hangs. The side opening a connection succeeds, but the other side never gets the StreamOpened event.

Demi-Marie avatar Jan 03 '20 22:01 Demi-Marie

If I have the side that opened the stream write to it first, the connection succeeds. It is only when the responder sends the first data that the stream hangs.

Demi-Marie avatar Jan 03 '20 22:01 Demi-Marie

I'm pretty sure that stream opening, by itself, does not notify the peer. So you have to send something when opening the stream to let the peer know that the stream is now active. Would that explain the hang you're seeing?

djc avatar Jan 04 '20 20:01 djc

@djc Yes, it would. Is sending an empty string sufficient?

Demi-Marie avatar Jan 06 '20 15:01 Demi-Marie

There are only bytes. You'd have to send at least one byte, I guess.

djc avatar Jan 06 '20 15:01 djc

Darn. That is a problem for protocols in which the server sends the first packet, such as SSH.

Demi-Marie avatar Jan 29 '20 19:01 Demi-Marie

Why is that a problem? Either peer can open streams whenever it likes.

Ralith avatar Jan 29 '20 20:01 Ralith