-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Connection::get_ref to retrieve a reference to the socket #196
Conversation
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.
Hi! And thanks for this, can you give more context on why you need to AsyncRead
and AsyncWrite
on the internal connection?
Hello, Now that I'm re-reading this, maybe the implementations of |
But how do you access those attributes if you are returning a |
The precise use case is for metrics: the let socket = Socket { metric: 0, ... };
let connection = yamux::Connection::new(socket, ...)
// calls to `poll_new_outbound`, `poll_next_inbound`...
let metric = connection.get_ref().unwrap().metric; |
thanks for elaborating, but if you are calling |
We never call The metrics are two simple counters for the total written and read bytes on the connection. Can you link me to the explicit APIs you mentioned in |
|
Yes that would work. Let's close this PR and I'll submit another with the changes you suggest (except if you'd prefer to take care of it!). |
no no, go ahead! |
This lets users of
Connection
immutably access the socket they provided.