-
Notifications
You must be signed in to change notification settings - Fork 258
*: update to grpc 1.26.0 #425
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
Conversation
Signed-off-by: Jay Lee <[email protected]>
Signed-off-by: Jay Lee <[email protected]>
slice.0.refcount = Box::into_raw(mem::transmute(ref_count)); | ||
slice | ||
unsafe { | ||
GrpcSlice(grpcio_sys::grpc_slice_from_copied_buffer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grpc_slice grpc_slice_new_with_len(void* p, size_t len,
void (*destroy)(void*, size_t)) {
grpc_slice slice;
slice.refcount = (new grpc_core::NewWithLenSliceRefcount(destroy, p, len))
->base_refcount();
slice.data.refcounted.bytes = static_cast<uint8_t*>(p);
slice.data.refcounted.length = len;
return slice;
}
Seems we can pass capacity
into grpc_slice_new_with_len
, and then
slice.data.refcounted.length = v.len();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to rely on the implement details of grpc_slice_new_with_len
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just not to rely grpc_core::NewWithLenSliceRefcount
is ok. slice.data.refcounted.length
is public for us, so we can adjust it if only we can ensure it's less than capacity
.
Otherwise memory copy is necessary, I think we need to avoid it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not rely on grpc_core::NewWithLenSliceRefCount
, then you can't for sure whether slice.data.refcounted.length
or its internal field is forwarded to destroy hook.
Signed-off-by: Jay Lee <[email protected]>
Signed-off-by: Jay Lee <[email protected]>
9ca916d
to
4fb4b92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: Jay Lee <[email protected]>
One breakage is that grpcio probably can't link statically on MacOS that is <= 10.13. A similar issue can be found alexcrichton/curl-rust#279. |
40f9214
to
9c25f03
Compare
Seems OK, I think most Mac devs stay up to date. |
Close #375.