Conversation
| * Note: The message does NOT take ownership of the body stream. | ||
| * The stream must not be destroyed until the message is complete. |
There was a problem hiding this comment.
we should, and the same comments for aws_http_message_set_body_stream is actually out dated, that I forgot to remove.
So, the input streams are refcounted, so that we should keep a refcount on it with the http message.
There was a problem hiding this comment.
to make the design easier to use, let's say it's an error to set both. you can only set either one of the regular body stream or the async body stream
|
|
||
| bool is_processing_read_messages : 1; | ||
|
|
||
| struct aws_io_message *pending_async_message; |
There was a problem hiding this comment.
comment on what does this do?
| if (msg) { | ||
| aws_mem_release(msg->allocator, msg); | ||
| } | ||
| s_shutdown_due_to_error(connection, connection->thread_data.encoder.async_error); | ||
| return; |
There was a problem hiding this comment.
trivial: seems like we can just goto error, with a aws_raise_error(connection->thread_data.encoder.async_error)
| /* If encoder is waiting for async body read, don't reschedule - the async callback will do it */ | ||
| if (connection->thread_data.encoder.state == AWS_H1_ENCODER_STATE_ASYNC_WAITING) { |
There was a problem hiding this comment.
the connection is a user of the encoder, so it is better to not know the implementation detail of the encoder.
It's better to have a helper function to check if encoder is waiting for data async, instead of just querying the state of the encoder.
| /* hacking around with adding connection to encoder. there should be a better way to do it */ | ||
| connection->thread_data.encoder.connection = connection; |
There was a problem hiding this comment.
the better way to decouple them is probably expose something like
aws_encoder_set_async_stream_read_done(callback, user_data);
So that we keep the logic of handling the stream read done within the connection instead of the encoder
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.