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
753b0544
Commit
753b0544
authored
7 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Properly unref some slices in Node glue code
parent
6e310068
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/node/ext/call.cc
+13
-4
13 additions, 4 deletions
src/node/ext/call.cc
src/node/ext/node_grpc.cc
+9
-3
9 additions, 3 deletions
src/node/ext/node_grpc.cc
with
22 additions
and
7 deletions
src/node/ext/call.cc
+
13
−
4
View file @
753b0544
...
@@ -574,6 +574,14 @@ void Call::CompleteBatch(bool is_final_op) {
...
@@ -574,6 +574,14 @@ void Call::CompleteBatch(bool is_final_op) {
}
}
NAN_METHOD
(
Call
::
New
)
{
NAN_METHOD
(
Call
::
New
)
{
/* Arguments:
* 0: Channel to make the call on
* 1: Method
* 2: Deadline
* 3: host
* 4: parent Call
* 5: propagation flags
*/
if
(
info
.
IsConstructCall
())
{
if
(
info
.
IsConstructCall
())
{
Call
*
call
;
Call
*
call
;
if
(
info
[
0
]
->
IsExternal
())
{
if
(
info
[
0
]
->
IsExternal
())
{
...
@@ -618,25 +626,26 @@ NAN_METHOD(Call::New) {
...
@@ -618,25 +626,26 @@ NAN_METHOD(Call::New) {
double
deadline
=
Nan
::
To
<
double
>
(
info
[
2
]).
FromJust
();
double
deadline
=
Nan
::
To
<
double
>
(
info
[
2
]).
FromJust
();
grpc_channel
*
wrapped_channel
=
channel
->
GetWrappedChannel
();
grpc_channel
*
wrapped_channel
=
channel
->
GetWrappedChannel
();
grpc_call
*
wrapped_call
;
grpc_call
*
wrapped_call
;
grpc_slice
method
=
CreateSliceFromString
(
Nan
::
To
<
String
>
(
info
[
1
]).
ToLocalChecked
());
if
(
info
[
3
]
->
IsString
())
{
if
(
info
[
3
]
->
IsString
())
{
grpc_slice
*
host
=
new
grpc_slice
;
grpc_slice
*
host
=
new
grpc_slice
;
*
host
=
CreateSliceFromString
(
*
host
=
CreateSliceFromString
(
Nan
::
To
<
String
>
(
info
[
3
]).
ToLocalChecked
());
Nan
::
To
<
String
>
(
info
[
3
]).
ToLocalChecked
());
wrapped_call
=
grpc_channel_create_call
(
wrapped_call
=
grpc_channel_create_call
(
wrapped_channel
,
parent_call
,
propagate_flags
,
wrapped_channel
,
parent_call
,
propagate_flags
,
GetCompletionQueue
(),
CreateSliceFromString
(
GetCompletionQueue
(),
method
,
Nan
::
To
<
String
>
(
info
[
1
]).
ToLocalChecked
()),
host
,
MillisecondsToTimespec
(
deadline
),
NULL
);
host
,
MillisecondsToTimespec
(
deadline
),
NULL
);
delete
host
;
delete
host
;
}
else
if
(
info
[
3
]
->
IsUndefined
()
||
info
[
3
]
->
IsNull
())
{
}
else
if
(
info
[
3
]
->
IsUndefined
()
||
info
[
3
]
->
IsNull
())
{
wrapped_call
=
grpc_channel_create_call
(
wrapped_call
=
grpc_channel_create_call
(
wrapped_channel
,
parent_call
,
propagate_flags
,
wrapped_channel
,
parent_call
,
propagate_flags
,
GetCompletionQueue
(),
CreateSliceFromString
(
GetCompletionQueue
(),
method
,
Nan
::
To
<
String
>
(
info
[
1
]).
ToLocalChecked
()),
NULL
,
MillisecondsToTimespec
(
deadline
),
NULL
);
NULL
,
MillisecondsToTimespec
(
deadline
),
NULL
);
}
else
{
}
else
{
return
Nan
::
ThrowTypeError
(
"Call's fourth argument must be a string"
);
return
Nan
::
ThrowTypeError
(
"Call's fourth argument must be a string"
);
}
}
grpc_slice_unref
(
method
);
call
=
new
Call
(
wrapped_call
);
call
=
new
Call
(
wrapped_call
);
Nan
::
Set
(
info
.
This
(),
Nan
::
New
(
"channel_"
).
ToLocalChecked
(),
Nan
::
Set
(
info
.
This
(),
Nan
::
New
(
"channel_"
).
ToLocalChecked
(),
channel_object
);
channel_object
);
...
...
This diff is collapsed.
Click to expand it.
src/node/ext/node_grpc.cc
+
9
−
3
View file @
753b0544
...
@@ -286,8 +286,10 @@ NAN_METHOD(MetadataKeyIsLegal) {
...
@@ -286,8 +286,10 @@ NAN_METHOD(MetadataKeyIsLegal) {
"headerKeyIsLegal's argument must be a string"
);
"headerKeyIsLegal's argument must be a string"
);
}
}
Local
<
String
>
key
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
Local
<
String
>
key
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
grpc_slice
slice
=
CreateSliceFromString
(
key
);
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
grpc_header_key_is_legal
(
CreateSliceFromString
(
key
))));
grpc_header_key_is_legal
(
slice
)));
grpc_slice_unref
(
slice
);
}
}
NAN_METHOD
(
MetadataNonbinValueIsLegal
)
{
NAN_METHOD
(
MetadataNonbinValueIsLegal
)
{
...
@@ -296,8 +298,10 @@ NAN_METHOD(MetadataNonbinValueIsLegal) {
...
@@ -296,8 +298,10 @@ NAN_METHOD(MetadataNonbinValueIsLegal) {
"metadataNonbinValueIsLegal's argument must be a string"
);
"metadataNonbinValueIsLegal's argument must be a string"
);
}
}
Local
<
String
>
value
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
Local
<
String
>
value
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
grpc_slice
slice
=
CreateSliceFromString
(
value
);
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
grpc_header_nonbin_value_is_legal
(
CreateSliceFromString
(
value
))));
grpc_header_nonbin_value_is_legal
(
slice
)));
grpc_slice_unref
(
slice
);
}
}
NAN_METHOD
(
MetadataKeyIsBinary
)
{
NAN_METHOD
(
MetadataKeyIsBinary
)
{
...
@@ -306,8 +310,10 @@ NAN_METHOD(MetadataKeyIsBinary) {
...
@@ -306,8 +310,10 @@ NAN_METHOD(MetadataKeyIsBinary) {
"metadataKeyIsLegal's argument must be a string"
);
"metadataKeyIsLegal's argument must be a string"
);
}
}
Local
<
String
>
key
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
Local
<
String
>
key
=
Nan
::
To
<
String
>
(
info
[
0
]).
ToLocalChecked
();
grpc_slice
slice
=
CreateSliceFromString
(
key
);
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
info
.
GetReturnValue
().
Set
(
static_cast
<
bool
>
(
grpc_is_binary_header
(
CreateSliceFromString
(
key
))));
grpc_is_binary_header
(
slice
)));
grpc_slice_unref
(
slice
);
}
}
static
grpc_ssl_roots_override_result
get_ssl_roots_override
(
static
grpc_ssl_roots_override_result
get_ssl_roots_override
(
...
...
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