Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ public void onResponseComplete(HttpStreamBase stream, int errorCode) {
}
}, useManualDataWrites);
completionFuture.complete((HttpStream) stream);
/* Active the stream for user */
/**
* Activate the stream for user after completing the future, otherwise the
* callbacks may be invoked without the stream being completed.
*
* `activate` is idempotent.
**/
try {
stream.activate();
} catch (CrtRuntimeException e) {
Expand Down
4 changes: 4 additions & 0 deletions src/native/http_request_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,10 @@ JNIEXPORT void JNICALL Java_software_amazon_awssdk_crt_http_HttpStreamBase_httpS

struct http_stream_binding *binding = (struct http_stream_binding *)jni_stream_binding;
struct aws_http_stream *stream = binding->native_stream;
if (binding->java_http_stream_base) {
/* Already activated */
return;
}

if (stream == NULL) {
aws_jni_throw_runtime_exception(env, "HttpStream is null.");
Expand Down
Loading