Removed an extra mark object, fixed some documentation

pull/6886/head
murgatroid99 9 years ago
parent 5ea4a99d8c
commit 1fa96c5c49
  1. 20
      src/ruby/ext/grpc/rb_server.c
  2. 4
      src/ruby/ext/grpc/rb_server_credentials.c

@ -53,11 +53,8 @@ static ID id_at;
/* id_insecure_server is used to indicate that a server is insecure */
static VALUE id_insecure_server;
/* grpc_rb_server wraps a grpc_server. It provides a peer ruby object,
'mark' to minimize copying when a server is created from ruby. */
/* grpc_rb_server wraps a grpc_server. */
typedef struct grpc_rb_server {
/* Holder of ruby objects involved in constructing the server */
VALUE mark;
/* The actual server */
grpc_server *wrapped;
grpc_completion_queue *queue;
@ -98,21 +95,9 @@ static void grpc_rb_server_free(void *p) {
xfree(p);
}
/* Protects the mark object from GC */
static void grpc_rb_server_mark(void *p) {
grpc_rb_server *server = NULL;
if (p == NULL) {
return;
}
server = (grpc_rb_server *)p;
if (server->mark != Qnil) {
rb_gc_mark(server->mark);
}
}
static const rb_data_type_t grpc_rb_server_data_type = {
"grpc_server",
{grpc_rb_server_mark, grpc_rb_server_free, GRPC_RB_MEMSIZE_UNAVAILABLE,
{GRPC_RB_GC_NOT_MARKED, grpc_rb_server_free, GRPC_RB_MEMSIZE_UNAVAILABLE,
{NULL, NULL}},
NULL,
NULL,
@ -129,7 +114,6 @@ static const rb_data_type_t grpc_rb_server_data_type = {
static VALUE grpc_rb_server_alloc(VALUE cls) {
grpc_rb_server *wrapper = ALLOC(grpc_rb_server);
wrapper->wrapped = NULL;
wrapper->mark = Qnil;
return TypedData_Wrap_Struct(cls, &grpc_rb_server_data_type, wrapper);
}

@ -46,8 +46,8 @@
static VALUE grpc_rb_cServerCredentials = Qnil;
/* grpc_rb_server_credentials wraps a grpc_server_credentials. It provides a
peer ruby object, 'mark' to minimize copying when a server credential is
created from ruby. */
peer ruby object, 'mark' to hold references to objects involved in
constructing the server credentials. */
typedef struct grpc_rb_server_credentials {
/* Holder of ruby objects involved in constructing the server credentials */
VALUE mark;

Loading…
Cancel
Save