Go to the documentation of this file.
19 #include <ruby/ruby.h>
59 if (!
server->shutdown_and_notify_done) {
60 server->shutdown_and_notify_done = 1;
61 if (
server->wrapped != NULL) {
71 "GRPC_RUBY: bad grpc_server_shutdown_and_notify result:%d",
80 if (!
server->destroy_done) {
82 if (
server->wrapped != NULL) {
122 #ifdef RUBY_TYPED_FREE_IMMEDIATELY
137 wrapper->shutdown_and_notify_done = 0;
159 if (
args.args != NULL) {
163 rb_raise(rb_eRuntimeError,
"could not create a gRPC server, not sure why");
205 void*
tag = (
void*)&st;
211 if (s->wrapped == NULL) {
212 rb_raise(rb_eRuntimeError,
"destroyed!");
219 call_queue, s->queue,
tag);
223 "grpc_server_request_call failed: %s (code=%d)",
241 rb_funcall(rb_cTime,
id_at, 2, INT2NUM(deadline.
tv_sec),
242 INT2NUM(deadline.
tv_nsec / 1000)),
254 if (s->wrapped == NULL) {
255 rb_raise(rb_eRuntimeError,
"destroyed!");
315 if (s->wrapped == NULL) {
316 rb_raise(rb_eRuntimeError,
"destroyed!");
318 }
else if (
TYPE(rb_creds) == T_SYMBOL) {
320 rb_raise(rb_eTypeError,
"bad creds symbol, want :this_port_is_insecure");
328 if (recvd_port == 0) {
329 rb_raise(rb_eRuntimeError,
330 "could not add port %s to server, not sure why",
331 StringValueCStr(
port));
342 rb_raise(rb_eTypeError,
343 "failed to create server because credentials parameter has an "
344 "invalid type, want ServerCredentials or XdsServerCredentials");
348 if (recvd_port == 0) {
349 rb_raise(rb_eRuntimeError,
350 "could not add secure port %s to server, not sure why",
351 StringValueCStr(
port));
354 return INT2NUM(recvd_port);
379 id_at = rb_intern(
"at");
VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice)
GRPCAPI void grpc_call_details_destroy(grpc_call_details *details)
GRPCAPI void grpc_call_details_init(grpc_call_details *details)
#define GRPC_RB_MEMSIZE_UNAVAILABLE
GRPCAPI grpc_completion_queue * grpc_completion_queue_create_for_pluck(void *reserved)
void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, grpc_channel_args *dst)
void grpc_ruby_shutdown()
#define GRPC_RB_GC_NOT_MARKED
static VALUE grpc_rb_cServer
static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args)
static void grpc_request_call_stack_init(request_call_stack *st)
grpc_event rb_completion_queue_pluck(grpc_completion_queue *queue, void *tag, gpr_timespec deadline, void *reserved)
GRPCAPI grpc_server * grpc_server_create(const grpc_channel_args *args, void *reserved)
GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, grpc_completion_queue *cq, void *reserved)
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
static const rb_data_type_t grpc_rb_server_data_type
int shutdown_and_notify_done
static VALUE grpc_rb_server_request_call(VALUE self)
static VALUE grpc_rb_server_shutdown_and_notify(VALUE self, VALUE timeout)
static void grpc_request_call_stack_cleanup(request_call_stack *st)
GRPCAPI grpc_server_credentials * grpc_insecure_server_credentials_create()
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array)
static void grpc_rb_server_free(void *p)
GRPCAPI grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new)
grpc_metadata_array md_ary
static void * tag(intptr_t t)
GRPCAPI void grpc_server_credentials_release(grpc_server_credentials *creds)
GRPCAPI int grpc_server_add_http2_port(grpc_server *server, const char *addr, grpc_server_credentials *creds)
static void grpc_rb_server_maybe_destroy(grpc_rb_server *server)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
VALUE grpc_rb_sNewServerRpc
struct grpc_call grpc_call
static VALUE id_insecure_server
bool grpc_rb_is_server_credentials(VALUE v)
grpc_server_credentials * grpc_rb_get_wrapped_xds_server_credentials(VALUE v)
struct grpc_server grpc_server
static VALUE grpc_rb_server_alloc(VALUE cls)
GRPCAPI void grpc_server_destroy(grpc_server *server)
static VALUE grpc_rb_server_destroy(VALUE self)
grpc_channel_wrapper * wrapper
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
grpc_completion_queue * queue
GRPCAPI void grpc_server_cancel_all_calls(grpc_server *server)
void grpc_rb_completion_queue_destroy(grpc_completion_queue *cq)
GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b)
gpr_timespec grpc_rb_time_timeval(VALUE time, int interval)
GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t, gpr_clock_type clock_type)
#define ALLOC(class_name)
VALUE grpc_rb_wrap_call(grpc_call *c, grpc_completion_queue *q)
VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self)
struct request_call_stack request_call_stack
static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port, VALUE rb_creds)
grpc_server * grpc_rb_get_wrapped_server(VALUE v)
GRPCAPI void grpc_server_shutdown_and_notify(grpc_server *server, grpc_completion_queue *cq, void *tag)
const char * grpc_call_error_detail_of(grpc_call_error err)
VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary)
grpc_call_details details
void grpc_ruby_fork_guard()
static void grpc_rb_server_free_internal(void *p)
grpc_completion_type type
grpc_server_credentials * grpc_rb_get_wrapped_server_credentials(VALUE v)
GRPCAPI void grpc_server_start(grpc_server *server)
static VALUE grpc_rb_server_start(VALUE self)
bool grpc_rb_is_xds_server_credentials(VALUE v)
static void grpc_rb_server_maybe_shutdown_and_notify(grpc_rb_server *server, gpr_timespec deadline)
struct grpc_rb_server grpc_rb_server
static grpc_completion_queue * cq
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array)
GPRAPI gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type clock_type)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:06