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
11bf14ec
Commit
11bf14ec
authored
9 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Trip through transient failure on disconnection
parent
abf36389
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
include/grpc/grpc.h
+2
-2
2 additions, 2 deletions
include/grpc/grpc.h
src/core/client_config/subchannel.c
+19
-9
19 additions, 9 deletions
src/core/client_config/subchannel.c
src/core/client_config/subchannel.h
+0
-2
0 additions, 2 deletions
src/core/client_config/subchannel.h
with
21 additions
and
13 deletions
include/grpc/grpc.h
+
2
−
2
View file @
11bf14ec
...
@@ -120,14 +120,14 @@ typedef struct {
...
@@ -120,14 +120,14 @@ typedef struct {
/** Connectivity state of a channel. */
/** Connectivity state of a channel. */
typedef
enum
{
typedef
enum
{
/** channel is idle */
GRPC_CHANNEL_IDLE
,
/** channel is connecting */
/** channel is connecting */
GRPC_CHANNEL_CONNECTING
,
GRPC_CHANNEL_CONNECTING
,
/** channel is ready for work */
/** channel is ready for work */
GRPC_CHANNEL_READY
,
GRPC_CHANNEL_READY
,
/** channel has seen a failure but expects to recover */
/** channel has seen a failure but expects to recover */
GRPC_CHANNEL_TRANSIENT_FAILURE
,
GRPC_CHANNEL_TRANSIENT_FAILURE
,
/** channel is idle */
GRPC_CHANNEL_IDLE
,
/** channel has seen a failure that it cannot recover from */
/** channel has seen a failure that it cannot recover from */
GRPC_CHANNEL_FATAL_FAILURE
GRPC_CHANNEL_FATAL_FAILURE
}
grpc_connectivity_state
;
}
grpc_connectivity_state
;
...
...
This diff is collapsed.
Click to expand it.
src/core/client_config/subchannel.c
+
19
−
9
View file @
11bf14ec
...
@@ -142,9 +142,15 @@ static void subchannel_destroy(grpc_subchannel *c);
...
@@ -142,9 +142,15 @@ static void subchannel_destroy(grpc_subchannel *c);
#else
#else
#define SUBCHANNEL_REF_LOCKED(p, r) subchannel_ref_locked((p))
#define SUBCHANNEL_REF_LOCKED(p, r) subchannel_ref_locked((p))
#define SUBCHANNEL_UNREF_LOCKED(p, r) subchannel_unref_locked((p))
#define SUBCHANNEL_UNREF_LOCKED(p, r) subchannel_unref_locked((p))
#define CONNECTION_REF_LOCKED(p, r) connection_ref_locked((p)
, __FILE__, __LINE__, (r)
)
#define CONNECTION_REF_LOCKED(p, r) connection_ref_locked((p))
#define CONNECTION_UNREF_LOCKED(p, r) connection_unref_locked((p)
, __FILE__, __LINE__, (r)
)
#define CONNECTION_UNREF_LOCKED(p, r) connection_unref_locked((p))
#define REF_PASS_ARGS
#define REF_PASS_ARGS
#define REF_LOG(name, p) \
do { \
} while (0)
#define UNREF_LOG(name, p) \
do { \
} while (0)
#endif
#endif
/*
/*
...
@@ -332,8 +338,7 @@ void grpc_subchannel_notify_on_state_change(grpc_subchannel *c,
...
@@ -332,8 +338,7 @@ void grpc_subchannel_notify_on_state_change(grpc_subchannel *c,
c
->
connecting
=
1
;
c
->
connecting
=
1
;
/* released by connection */
/* released by connection */
SUBCHANNEL_REF_LOCKED
(
c
,
"connecting"
);
SUBCHANNEL_REF_LOCKED
(
c
,
"connecting"
);
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
connectivity_state_changed_locked
(
c
);
compute_connectivity_locked
(
c
));
}
}
gpr_mu_unlock
(
&
c
->
mu
);
gpr_mu_unlock
(
&
c
->
mu
);
if
(
do_connect
)
{
if
(
do_connect
)
{
...
@@ -348,8 +353,7 @@ void grpc_subchannel_process_transport_op(grpc_subchannel *c,
...
@@ -348,8 +353,7 @@ void grpc_subchannel_process_transport_op(grpc_subchannel *c,
gpr_mu_lock
(
&
c
->
mu
);
gpr_mu_lock
(
&
c
->
mu
);
if
(
op
->
disconnect
)
{
if
(
op
->
disconnect
)
{
c
->
disconnected
=
1
;
c
->
disconnected
=
1
;
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
connectivity_state_changed_locked
(
c
);
compute_connectivity_locked
(
c
));
}
}
if
(
c
->
active
!=
NULL
)
{
if
(
c
->
active
!=
NULL
)
{
con
=
c
->
active
;
con
=
c
->
active
;
...
@@ -389,6 +393,8 @@ static void on_state_changed(void *p, int iomgr_success) {
...
@@ -389,6 +393,8 @@ static void on_state_changed(void *p, int iomgr_success) {
goto
done
;
goto
done
;
}
}
gpr_log
(
GPR_DEBUG
,
"TRANSPORT STATE: %d"
,
sw
->
connectivity_state
);
switch
(
sw
->
connectivity_state
)
{
switch
(
sw
->
connectivity_state
)
{
case
GRPC_CHANNEL_CONNECTING
:
case
GRPC_CHANNEL_CONNECTING
:
case
GRPC_CHANNEL_READY
:
case
GRPC_CHANNEL_READY
:
...
@@ -409,19 +415,22 @@ static void on_state_changed(void *p, int iomgr_success) {
...
@@ -409,19 +415,22 @@ static void on_state_changed(void *p, int iomgr_success) {
destroy_connection
=
sw
->
subchannel
->
active
;
destroy_connection
=
sw
->
subchannel
->
active
;
}
}
sw
->
subchannel
->
active
=
NULL
;
sw
->
subchannel
->
active
=
NULL
;
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
GRPC_CHANNEL_TRANSIENT_FAILURE
);
break
;
break
;
case
GRPC_CHANNEL_TRANSIENT_FAILURE
:
case
GRPC_CHANNEL_TRANSIENT_FAILURE
:
/* things are starting to go wrong, reconnect but don't deactivate */
/* things are starting to go wrong, reconnect but don't deactivate */
/* released by connection */
/* released by connection */
SUBCHANNEL_REF_LOCKED
(
c
,
"connecting"
);
SUBCHANNEL_REF_LOCKED
(
c
,
"connecting"
);
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
GRPC_CHANNEL_TRANSIENT_FAILURE
);
do_connect
=
1
;
do_connect
=
1
;
c
->
connecting
=
1
;
c
->
connecting
=
1
;
break
;
break
;
}
}
done:
done:
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
connectivity_state_changed_locked
(
c
);
compute_connectivity_locked
(
c
));
destroy
=
SUBCHANNEL_UNREF_LOCKED
(
c
,
"state_watcher"
);
destroy
=
SUBCHANNEL_UNREF_LOCKED
(
c
,
"state_watcher"
);
gpr_free
(
sw
);
gpr_free
(
sw
);
gpr_mu_unlock
(
mu
);
gpr_mu_unlock
(
mu
);
...
@@ -521,7 +530,7 @@ static void publish_transport(grpc_subchannel *c) {
...
@@ -521,7 +530,7 @@ static void publish_transport(grpc_subchannel *c) {
static
void
subchannel_connected
(
void
*
arg
,
int
iomgr_success
)
{
static
void
subchannel_connected
(
void
*
arg
,
int
iomgr_success
)
{
grpc_subchannel
*
c
=
arg
;
grpc_subchannel
*
c
=
arg
;
if
(
c
->
connecting_result
.
transport
)
{
if
(
c
->
connecting_result
.
transport
!=
NULL
)
{
publish_transport
(
c
);
publish_transport
(
c
);
}
else
{
}
else
{
int
destroy
;
int
destroy
;
...
@@ -553,6 +562,7 @@ static grpc_connectivity_state compute_connectivity_locked(grpc_subchannel *c) {
...
@@ -553,6 +562,7 @@ static grpc_connectivity_state compute_connectivity_locked(grpc_subchannel *c) {
static
void
connectivity_state_changed_locked
(
grpc_subchannel
*
c
)
{
static
void
connectivity_state_changed_locked
(
grpc_subchannel
*
c
)
{
grpc_connectivity_state
current
=
compute_connectivity_locked
(
c
);
grpc_connectivity_state
current
=
compute_connectivity_locked
(
c
);
gpr_log
(
GPR_DEBUG
,
"SUBCHANNEL constate=%d"
,
current
);
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
current
);
grpc_connectivity_state_set
(
&
c
->
state_tracker
,
current
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/client_config/subchannel.h
+
0
−
2
View file @
11bf14ec
...
@@ -43,8 +43,6 @@ typedef struct grpc_subchannel grpc_subchannel;
...
@@ -43,8 +43,6 @@ typedef struct grpc_subchannel grpc_subchannel;
typedef
struct
grpc_subchannel_call
grpc_subchannel_call
;
typedef
struct
grpc_subchannel_call
grpc_subchannel_call
;
typedef
struct
grpc_subchannel_args
grpc_subchannel_args
;
typedef
struct
grpc_subchannel_args
grpc_subchannel_args
;
#define GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#ifdef GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#ifdef GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#define GRPC_SUBCHANNEL_REF(p, r) grpc_subchannel_ref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_REF(p, r) grpc_subchannel_ref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_UNREF(p, r) grpc_subchannel_unref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_UNREF(p, r) grpc_subchannel_unref((p), __FILE__, __LINE__, (r))
...
...
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