Skip to content
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

Proxy example - is reconnecting to the server every loop necessary? #329

Open
timClicks opened this issue Jul 9, 2018 · 0 comments
Open

Comments

@timClicks
Copy link

Apologies if this is the incorrect place to ask for help! I'm attempting to grok some of the examples and just wondering if I'm reading something correctly..

In the proxy example, the code appears to connect to the remote server at every message?

    let done = socket.incoming().for_each(move |(client, client_addr)| {
        let server = TcpStream::connect(&server_addr, &handle);  // ??
        let amounts = server.and_then(move |server| {
            // ...
        });
        // ...
        Ok(())
});

Perhaps I'm making a mistake regard what socket is iterating over in the call to socket.incoming().for_each()? How many iterations per connection would one expect on a long lived connection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant