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
95fcb58f
Commit
95fcb58f
authored
8 years ago
by
Mark D. Roth
Browse files
Options
Downloads
Patches
Plain Diff
Remove redundant fields for endpoints.
parent
3beb6c52
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/lib/security/transport/security_handshaker.c
+9
-18
9 additions, 18 deletions
src/core/lib/security/transport/security_handshaker.c
with
9 additions
and
18 deletions
src/core/lib/security/transport/security_handshaker.c
+
9
−
18
View file @
95fcb58f
...
@@ -60,9 +60,6 @@ typedef struct {
...
@@ -60,9 +60,6 @@ typedef struct {
gpr_refcount
refs
;
gpr_refcount
refs
;
unsigned
char
*
handshake_buffer
;
unsigned
char
*
handshake_buffer
;
size_t
handshake_buffer_size
;
size_t
handshake_buffer_size
;
// FIXME: use args->endpoint instead
grpc_endpoint
*
wrapped_endpoint
;
grpc_endpoint
*
secure_endpoint
;
grpc_slice_buffer
left_overs
;
grpc_slice_buffer
left_overs
;
grpc_slice_buffer
outgoing
;
grpc_slice_buffer
outgoing
;
grpc_closure
on_handshake_data_sent_to_peer
;
grpc_closure
on_handshake_data_sent_to_peer
;
...
@@ -95,7 +92,6 @@ static void security_handshake_done_locked(grpc_exec_ctx *exec_ctx,
...
@@ -95,7 +92,6 @@ static void security_handshake_done_locked(grpc_exec_ctx *exec_ctx,
security_handshaker
*
h
,
security_handshaker
*
h
,
grpc_error
*
error
)
{
grpc_error
*
error
)
{
if
(
error
==
GRPC_ERROR_NONE
)
{
if
(
error
==
GRPC_ERROR_NONE
)
{
h
->
args
->
endpoint
=
h
->
secure_endpoint
;
grpc_arg
auth_context_arg
=
grpc_auth_context_to_arg
(
h
->
auth_context
);
grpc_arg
auth_context_arg
=
grpc_auth_context_to_arg
(
h
->
auth_context
);
grpc_channel_args
*
tmp_args
=
h
->
args
->
args
;
grpc_channel_args
*
tmp_args
=
h
->
args
->
args
;
h
->
args
->
args
=
h
->
args
->
args
=
...
@@ -105,16 +101,12 @@ static void security_handshake_done_locked(grpc_exec_ctx *exec_ctx,
...
@@ -105,16 +101,12 @@ static void security_handshake_done_locked(grpc_exec_ctx *exec_ctx,
const
char
*
msg
=
grpc_error_string
(
error
);
const
char
*
msg
=
grpc_error_string
(
error
);
gpr_log
(
GPR_DEBUG
,
"Security handshake failed: %s"
,
msg
);
gpr_log
(
GPR_DEBUG
,
"Security handshake failed: %s"
,
msg
);
grpc_error_free_string
(
msg
);
grpc_error_free_string
(
msg
);
if
(
h
->
secure_endpoint
!=
NULL
)
{
grpc_endpoint_shutdown
(
exec_ctx
,
h
->
args
->
endpoint
);
grpc_endpoint_shutdown
(
exec_ctx
,
h
->
secure_endpoint
);
// FIXME: clarify who should destroy...
// FIXME: clarify who should destroy...
// grpc_endpoint_destroy(exec_ctx, h->secure_endpoint);
//grpc_endpoint_destroy(exec_ctx, h->args->endpoint);
// } else {
// grpc_endpoint_destroy(exec_ctx, h->wrapped_endpoint);
}
}
}
// Clear out the read buffer before it gets passed to the transport,
// Clear out the read buffer before it gets passed to the transport,
// since any excess bytes were already
mov
ed to h->left_overs.
// since any excess bytes were already
copi
ed to h->left_overs.
grpc_slice_buffer_reset_and_unref
(
h
->
args
->
read_buffer
);
grpc_slice_buffer_reset_and_unref
(
h
->
args
->
read_buffer
);
h
->
args
=
NULL
;
h
->
args
=
NULL
;
grpc_exec_ctx_sched
(
exec_ctx
,
h
->
on_handshake_done
,
error
,
NULL
);
grpc_exec_ctx_sched
(
exec_ctx
,
h
->
on_handshake_done
,
error
,
NULL
);
...
@@ -138,8 +130,8 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg,
...
@@ -138,8 +130,8 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_ERROR_CREATE
(
"Frame protector creation failed"
),
result
);
GRPC_ERROR_CREATE
(
"Frame protector creation failed"
),
result
);
goto
done
;
goto
done
;
}
}
h
->
secure_
endpoint
=
h
->
args
->
endpoint
=
grpc_secure_endpoint_create
(
protector
,
h
->
wrapped_
endpoint
,
grpc_secure_endpoint_create
(
protector
,
h
->
args
->
endpoint
,
h
->
left_overs
.
slices
,
h
->
left_overs
.
count
);
h
->
left_overs
.
slices
,
h
->
left_overs
.
count
);
h
->
left_overs
.
count
=
0
;
h
->
left_overs
.
count
=
0
;
h
->
left_overs
.
length
=
0
;
h
->
left_overs
.
length
=
0
;
...
@@ -187,7 +179,7 @@ static grpc_error* send_handshake_bytes_to_peer_locked(grpc_exec_ctx *exec_ctx,
...
@@ -187,7 +179,7 @@ static grpc_error* send_handshake_bytes_to_peer_locked(grpc_exec_ctx *exec_ctx,
grpc_slice_from_copied_buffer
((
const
char
*
)
h
->
handshake_buffer
,
offset
);
grpc_slice_from_copied_buffer
((
const
char
*
)
h
->
handshake_buffer
,
offset
);
grpc_slice_buffer_reset_and_unref
(
&
h
->
outgoing
);
grpc_slice_buffer_reset_and_unref
(
&
h
->
outgoing
);
grpc_slice_buffer_add
(
&
h
->
outgoing
,
to_send
);
grpc_slice_buffer_add
(
&
h
->
outgoing
,
to_send
);
grpc_endpoint_write
(
exec_ctx
,
h
->
wrapped_
endpoint
,
&
h
->
outgoing
,
grpc_endpoint_write
(
exec_ctx
,
h
->
args
->
endpoint
,
&
h
->
outgoing
,
&
h
->
on_handshake_data_sent_to_peer
);
&
h
->
on_handshake_data_sent_to_peer
);
return
GRPC_ERROR_NONE
;
return
GRPC_ERROR_NONE
;
}
}
...
@@ -219,7 +211,7 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
...
@@ -219,7 +211,7 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
if
(
tsi_handshaker_is_in_progress
(
h
->
handshaker
))
{
if
(
tsi_handshaker_is_in_progress
(
h
->
handshaker
))
{
/* We may need more data. */
/* We may need more data. */
if
(
result
==
TSI_INCOMPLETE_DATA
)
{
if
(
result
==
TSI_INCOMPLETE_DATA
)
{
grpc_endpoint_read
(
exec_ctx
,
h
->
wrapped_
endpoint
,
h
->
args
->
read_buffer
,
grpc_endpoint_read
(
exec_ctx
,
h
->
args
->
endpoint
,
h
->
args
->
read_buffer
,
&
h
->
on_handshake_data_received_from_peer
);
&
h
->
on_handshake_data_received_from_peer
);
goto
done
;
goto
done
;
}
else
{
}
else
{
...
@@ -294,7 +286,7 @@ static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
...
@@ -294,7 +286,7 @@ static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
/* We may be done. */
/* We may be done. */
gpr_mu_lock
(
&
h
->
mu
);
gpr_mu_lock
(
&
h
->
mu
);
if
(
tsi_handshaker_is_in_progress
(
h
->
handshaker
))
{
if
(
tsi_handshaker_is_in_progress
(
h
->
handshaker
))
{
grpc_endpoint_read
(
exec_ctx
,
h
->
wrapped_
endpoint
,
h
->
args
->
read_buffer
,
grpc_endpoint_read
(
exec_ctx
,
h
->
args
->
endpoint
,
h
->
args
->
read_buffer
,
&
h
->
on_handshake_data_received_from_peer
);
&
h
->
on_handshake_data_received_from_peer
);
}
else
{
}
else
{
error
=
check_peer_locked
(
exec_ctx
,
h
);
error
=
check_peer_locked
(
exec_ctx
,
h
);
...
@@ -323,7 +315,7 @@ static void security_handshaker_shutdown(grpc_exec_ctx* exec_ctx,
...
@@ -323,7 +315,7 @@ static void security_handshaker_shutdown(grpc_exec_ctx* exec_ctx,
security_handshaker
*
h
=
(
security_handshaker
*
)
handshaker
;
security_handshaker
*
h
=
(
security_handshaker
*
)
handshaker
;
gpr_mu_lock
(
&
h
->
mu
);
gpr_mu_lock
(
&
h
->
mu
);
if
(
h
->
args
!=
NULL
)
{
if
(
h
->
args
!=
NULL
)
{
grpc_endpoint_shutdown
(
exec_ctx
,
h
->
wrapped_
endpoint
);
grpc_endpoint_shutdown
(
exec_ctx
,
h
->
args
->
endpoint
);
}
}
gpr_mu_unlock
(
&
h
->
mu
);
gpr_mu_unlock
(
&
h
->
mu
);
}
}
...
@@ -336,7 +328,6 @@ static void security_handshaker_do_handshake(
...
@@ -336,7 +328,6 @@ static void security_handshaker_do_handshake(
gpr_mu_lock
(
&
h
->
mu
);
gpr_mu_lock
(
&
h
->
mu
);
h
->
args
=
args
;
h
->
args
=
args
;
h
->
on_handshake_done
=
on_handshake_done
;
h
->
on_handshake_done
=
on_handshake_done
;
h
->
wrapped_endpoint
=
args
->
endpoint
;
// FIXME: remove?
gpr_ref
(
&
h
->
refs
);
gpr_ref
(
&
h
->
refs
);
grpc_error
*
error
=
send_handshake_bytes_to_peer_locked
(
exec_ctx
,
h
);
grpc_error
*
error
=
send_handshake_bytes_to_peer_locked
(
exec_ctx
,
h
);
if
(
error
!=
GRPC_ERROR_NONE
)
{
if
(
error
!=
GRPC_ERROR_NONE
)
{
...
...
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