envoy icon indicating copy to clipboard operation
envoy copied to clipboard

mobile: Update the StreamCallbacks context to take a wrapper pointer

Open abeyad opened this issue 1 year ago • 4 comments

Because the envoy_http_callbacks context requires a void* so that it can store JNI's context too, we previously created a new instance of StreamCallbacks from its shared_ptr, which was quite confusing.

Instead, we create a wrapper class to hold the shared_ptr, and delete the wrapper class pointer in the corresponding c_on_complete, c_on_error, etc. functions to trigger the shared_ptr destructor of the underlying StreamCallbacks.

Unfortunately, it's not very straightforward to get rid of envoy_http_callbacks or remove the need for a raw pointer since JNI uses the same interface, which passes in a raw pointer (in the form of a jobject).

abeyad avatar Feb 21 '24 18:02 abeyad

/wait

abeyad avatar Feb 21 '24 18:02 abeyad

/retest

abeyad avatar Feb 25 '24 21:02 abeyad

See the PR description for why we need the raw pointer and why getting rid of envoy_http_callbacks isn't so straightforward.

abeyad avatar Feb 25 '24 21:02 abeyad

/retest

abeyad avatar Feb 25 '24 22:02 abeyad

/retest

abeyad avatar Feb 27 '24 01:02 abeyad