-
Notifications
You must be signed in to change notification settings - Fork 50
Unified write data API #552
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
Changes from 2 commits
e5e3b4e
b070017
8431439
26661ab
ec85f76
ef57a49
b3e2af9
af32dd9
1f7c463
732fcfe
b08bcaf
af0bb7a
b265ed4
a78369c
99b7cb5
89b28d5
7242285
f590520
486817c
55efd1b
2f69171
2d7a9f0
dd6f393
f463ee3
5829245
9aef1ba
5a5d314
f68f849
e846d2b
43ae56f
b7febda
20d8235
ad027eb
d01c000
ead0539
a9315c1
fc43b59
83aaf18
e5350ed
ed627b7
925893a
5e1f774
944d1e5
fd05f03
03a69d6
6db38be
089f8e9
f572900
28d3999
cb6cd15
f98dd3d
ccb0d1b
b233ea6
6552bb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,15 @@ enum aws_h1_stream_api_state { | |
| AWS_H1_STREAM_API_STATE_COMPLETE, | ||
| }; | ||
|
|
||
| struct aws_h1_data_write { | ||
| struct aws_allocator *allocator; | ||
| struct aws_input_stream *data; | ||
| aws_http_stream_write_complete_fn *on_complete; | ||
| void *user_data; | ||
| struct aws_linked_list_node node; | ||
| bool is_end_stream; | ||
| }; | ||
|
|
||
| struct aws_h1_stream { | ||
| struct aws_http_stream base; | ||
|
|
||
|
|
@@ -66,9 +75,21 @@ struct aws_h1_stream { | |
| * Only body data (not headers, etc) counts against the stream's flow-control window. */ | ||
| uint64_t stream_window; | ||
|
|
||
| /* List of `struct aws_h1_data_write` which have been moved from synced_data for processing */ | ||
| struct aws_linked_list pending_data_write_list; | ||
|
|
||
| /* Whether the stream is using manual data writes instead of input_stream */ | ||
| bool using_manual_data_writes : 1; | ||
|
|
||
| /* Whether the final data write (with is_end_stream=true) has been received */ | ||
| bool has_final_data_write : 1; | ||
|
|
||
| /* Whether a "request handler" stream has a response to send. | ||
| * Has mirror variable in synced_data */ | ||
| bool has_outgoing_response : 1; | ||
|
|
||
| /* Total bytes written so far for Content-Length validation */ | ||
| uint64_t incremental_content_written; | ||
| } thread_data; | ||
|
|
||
| /* Any thread may touch this data, but the connection's lock must be held. | ||
|
|
@@ -83,6 +104,10 @@ struct aws_h1_stream { | |
| * but haven't yet moved to thread_data.encoder_message.pending_chunk_list where the encoder will find them. */ | ||
| struct aws_linked_list pending_chunk_list; | ||
|
|
||
| /* List of `struct aws_h1_data_write` which have been submitted by user, | ||
| * but haven't yet moved to thread_data.pending_data_write_list where the encoder will find them. */ | ||
| struct aws_linked_list pending_data_write_list; | ||
|
|
||
| /* trailing headers which have been submitted by user, | ||
| * but haven't yet moved to thread_data.encoder_message where the encoder will find them. */ | ||
| struct aws_h1_trailer *pending_trailer; | ||
|
|
@@ -102,9 +127,15 @@ struct aws_h1_stream { | |
| /* Whether the outgoing message is using chunked encoding */ | ||
| bool using_chunked_encoding : 1; | ||
|
|
||
| /* Whether the stream is using manual data writes instead of input_stream */ | ||
| bool using_manual_data_writes : 1; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need BTW, the reason of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's move this out |
||
|
|
||
| /* Whether the final 0 length chunk has already been sent */ | ||
| bool has_final_chunk : 1; | ||
|
|
||
| /* Whether the final data write (with is_end_stream=true) has been received */ | ||
| bool has_final_data_write : 1; | ||
|
|
||
| /* Whether the chunked trailer has already been sent */ | ||
| bool has_added_trailer : 1; | ||
| } synced_data; | ||
|
|
@@ -123,4 +154,15 @@ void aws_h1_stream_cancel(struct aws_http_stream *stream, int error_code); | |
|
|
||
| int aws_h1_stream_send_response(struct aws_h1_stream *stream, struct aws_http_message *response); | ||
|
|
||
| struct aws_h1_data_write *aws_h1_data_write_new( | ||
| struct aws_allocator *allocator, | ||
| const struct aws_http_stream_write_data_options *options); | ||
|
|
||
| void aws_h1_data_write_destroy(struct aws_h1_data_write *data_write); | ||
|
|
||
| void aws_h1_data_write_complete_and_destroy( | ||
| struct aws_h1_data_write *data_write, | ||
| struct aws_http_stream *http_stream, | ||
| int error_code); | ||
|
|
||
| #endif /* AWS_HTTP_H1_STREAM_H */ | ||
Uh oh!
There was an error while loading. Please reload this page.