Skip to content

Fixes #635 - bug in async server's connection read #637

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

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

deanberris
Copy link
Member

This changes the example file server to use the read handler for
POST/PUT requests. This currently assumes that there's a content-length
header (not much error handling is happening here, but it's meant as a
proof of concept anyway).

Using this code path in an example should be good enough for the moment
until we have better tests and a better API for this functionality.

This changes the example file server to use the read handler for
POST/PUT requests. This currently assumes that there's a content-length
header (not much error handling is happening here, but it's meant as a
proof of concept anyway).

Using this code path in an example should be good enough for the moment
until we have better tests and a better API for this functionality.
@deanberris
Copy link
Member Author

References #635 -- looking for reviewers and people to try it out.

@glynos glynos merged commit ec08b28 into cpp-netlib:0.12-release Apr 19, 2016
@@ -389,11 +389,12 @@ struct async_connection
}

auto self = this->shared_from_this();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need self here anymore, since it is not used in the lambda (can also be removed from the capture section of the lambda).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this "self" variable makes sure that the object is alive -- it ensures that there's a shared reference in the callback that depends on the state of the connection. It's a trick that's tied to how asynchronous programming is really hard to debug. 😀

@deanberris deanberris deleted the topic/fix-async-server branch April 20, 2016 12:11
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

Successfully merging this pull request may close these issues.

3 participants