Skip to content

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

Open
@timClicks

Description

@timClicks

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions