Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
91633cb2
Commit
91633cb2
authored
8 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Fix undefined reference in Ruby code, add linker warning
parent
91991a23
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ruby/ext/grpc/extconf.rb
+1
-0
1 addition, 0 deletions
src/ruby/ext/grpc/extconf.rb
src/ruby/ext/grpc/rb_channel.c
+19
-6
19 additions, 6 deletions
src/ruby/ext/grpc/rb_channel.c
src/ruby/ext/grpc/rb_completion_queue.h
+0
-3
0 additions, 3 deletions
src/ruby/ext/grpc/rb_completion_queue.h
with
20 additions
and
9 deletions
src/ruby/ext/grpc/extconf.rb
+
1
−
0
View file @
91633cb2
...
@@ -92,6 +92,7 @@ if grpc_config == 'gcov'
...
@@ -92,6 +92,7 @@ if grpc_config == 'gcov'
end
end
$LDFLAGS
<<
' -Wl,-wrap,memcpy'
if
RUBY_PLATFORM
=~
/linux/
$LDFLAGS
<<
' -Wl,-wrap,memcpy'
if
RUBY_PLATFORM
=~
/linux/
$LDFLAGS
<<
' -Wl,--no-undefined'
$LDFLAGS
<<
' -static'
if
windows
$LDFLAGS
<<
' -static'
if
windows
$CFLAGS
<<
' -std=c99 '
$CFLAGS
<<
' -std=c99 '
...
...
This diff is collapsed.
Click to expand it.
src/ruby/ext/grpc/rb_channel.c
+
19
−
6
View file @
91633cb2
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include
<grpc/grpc_security.h>
#include
<grpc/grpc_security.h>
#include
<grpc/support/alloc.h>
#include
<grpc/support/alloc.h>
#include
<grpc/support/log.h>
#include
<grpc/support/log.h>
#include
<grpc/support/time.h>
#include
"rb_grpc.h"
#include
"rb_grpc.h"
#include
"rb_call.h"
#include
"rb_call.h"
#include
"rb_channel_args.h"
#include
"rb_channel_args.h"
...
@@ -71,6 +72,7 @@ typedef struct grpc_rb_channel {
...
@@ -71,6 +72,7 @@ typedef struct grpc_rb_channel {
/* The actual channel */
/* The actual channel */
grpc_channel
*
wrapped
;
grpc_channel
*
wrapped
;
grpc_completion_queue
*
queue
;
}
grpc_rb_channel
;
}
grpc_rb_channel
;
/* Destroys Channel instances. */
/* Destroys Channel instances. */
...
@@ -83,6 +85,7 @@ static void grpc_rb_channel_free(void *p) {
...
@@ -83,6 +85,7 @@ static void grpc_rb_channel_free(void *p) {
if
(
ch
->
wrapped
!=
NULL
)
{
if
(
ch
->
wrapped
!=
NULL
)
{
grpc_channel_destroy
(
ch
->
wrapped
);
grpc_channel_destroy
(
ch
->
wrapped
);
grpc_rb_completion_queue_destroy
(
ch
->
queue
);
}
}
xfree
(
p
);
xfree
(
p
);
...
@@ -165,6 +168,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
...
@@ -165,6 +168,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
}
}
rb_ivar_set
(
self
,
id_target
,
target
);
rb_ivar_set
(
self
,
id_target
,
target
);
wrapper
->
wrapped
=
ch
;
wrapper
->
wrapped
=
ch
;
wrapper
->
queue
=
grpc_completion_queue_create
(
NULL
);
return
self
;
return
self
;
}
}
...
@@ -203,16 +207,18 @@ static VALUE grpc_rb_channel_get_connectivity_state(int argc, VALUE *argv,
...
@@ -203,16 +207,18 @@ static VALUE grpc_rb_channel_get_connectivity_state(int argc, VALUE *argv,
the completion queue with success=0 */
the completion queue with success=0 */
static
VALUE
grpc_rb_channel_watch_connectivity_state
(
VALUE
self
,
static
VALUE
grpc_rb_channel_watch_connectivity_state
(
VALUE
self
,
VALUE
last_state
,
VALUE
last_state
,
VALUE
cqueue
,
VALUE
deadline
)
{
VALUE
deadline
,
VALUE
tag
)
{
grpc_rb_channel
*
wrapper
=
NULL
;
grpc_rb_channel
*
wrapper
=
NULL
;
grpc_channel
*
ch
=
NULL
;
grpc_channel
*
ch
=
NULL
;
grpc_completion_queue
*
cq
=
NULL
;
grpc_completion_queue
*
cq
=
NULL
;
cq
=
grpc_rb_get_wrapped_completion_queue
(
cqueue
);
void
*
tag
=
wrapper
;
grpc_event
event
;
TypedData_Get_Struct
(
self
,
grpc_rb_channel
,
&
grpc_channel_data_type
,
wrapper
);
TypedData_Get_Struct
(
self
,
grpc_rb_channel
,
&
grpc_channel_data_type
,
wrapper
);
ch
=
wrapper
->
wrapped
;
ch
=
wrapper
->
wrapped
;
cq
=
wrapper
->
queue
;
if
(
ch
==
NULL
)
{
if
(
ch
==
NULL
)
{
rb_raise
(
rb_eRuntimeError
,
"closed!"
);
rb_raise
(
rb_eRuntimeError
,
"closed!"
);
return
Qnil
;
return
Qnil
;
...
@@ -222,9 +228,16 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
...
@@ -222,9 +228,16 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
(
grpc_connectivity_state
)
NUM2LONG
(
last_state
),
(
grpc_connectivity_state
)
NUM2LONG
(
last_state
),
grpc_rb_time_timeval
(
deadline
,
/* absolute time */
0
),
grpc_rb_time_timeval
(
deadline
,
/* absolute time */
0
),
cq
,
cq
,
ROBJECT
(
tag
)
)
;
tag
);
return
Qnil
;
event
=
rb_completion_queue_pluck
(
cq
,
tag
,
gpr_inf_future
(
GPR_CLOCK_REALTIME
),
NULL
);
if
(
event
.
success
)
{
return
Qtrue
;
}
else
{
return
Qfalse
;
}
}
}
/* Create a call given a grpc_channel, in order to call method. The request
/* Create a call given a grpc_channel, in order to call method. The request
...
...
This diff is collapsed.
Click to expand it.
src/ruby/ext/grpc/rb_completion_queue.h
+
0
−
3
View file @
91633cb2
...
@@ -38,9 +38,6 @@
...
@@ -38,9 +38,6 @@
#include
<grpc/grpc.h>
#include
<grpc/grpc.h>
/* Gets the wrapped completion queue from the ruby wrapper */
grpc_completion_queue
*
grpc_rb_get_wrapped_completion_queue
(
VALUE
v
);
void
grpc_rb_completion_queue_destroy
(
grpc_completion_queue
*
cq
);
void
grpc_rb_completion_queue_destroy
(
grpc_completion_queue
*
cq
);
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment