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
2f25d98b
Commit
2f25d98b
authored
9 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
properly decrement active_ports
parent
7716c53a
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/iomgr/tcp_server_windows.c
+17
-8
17 additions, 8 deletions
src/core/iomgr/tcp_server_windows.c
with
17 additions
and
8 deletions
src/core/iomgr/tcp_server_windows.c
+
17
−
8
View file @
2f25d98b
...
@@ -186,6 +186,17 @@ error:
...
@@ -186,6 +186,17 @@ error:
return
-
1
;
return
-
1
;
}
}
static
void
decrement_active_ports_and_notify
(
server_port
*
sp
)
{
sp
->
shutting_down
=
0
;
sp
->
socket
->
read_info
.
outstanding
=
0
;
gpr_mu_lock
(
&
sp
->
server
->
mu
);
GPR_ASSERT
(
sp
->
server
->
active_ports
>
0
);
if
(
0
==
--
sp
->
server
->
active_ports
)
{
gpr_cv_broadcast
(
&
sp
->
server
->
cv
);
}
gpr_mu_unlock
(
&
sp
->
server
->
mu
);
}
/* start_accept will reference that for the IOCP notification request. */
/* start_accept will reference that for the IOCP notification request. */
static
void
on_accept
(
void
*
arg
,
int
from_iocp
);
static
void
on_accept
(
void
*
arg
,
int
from_iocp
);
...
@@ -234,6 +245,11 @@ static void start_accept(server_port *port) {
...
@@ -234,6 +245,11 @@ static void start_accept(server_port *port) {
return
;
return
;
failure:
failure:
if
(
port
->
shutting_down
)
{
/* We are abandoning the listener port, take that into account to prevent
occasional hangs on shutdown. */
decrement_active_ports_and_notify
(
port
);
}
utf8_message
=
gpr_format_message
(
WSAGetLastError
());
utf8_message
=
gpr_format_message
(
WSAGetLastError
());
gpr_log
(
GPR_ERROR
,
message
,
utf8_message
);
gpr_log
(
GPR_ERROR
,
message
,
utf8_message
);
gpr_free
(
utf8_message
);
gpr_free
(
utf8_message
);
...
@@ -277,14 +293,7 @@ static void on_accept(void *arg, int from_iocp) {
...
@@ -277,14 +293,7 @@ static void on_accept(void *arg, int from_iocp) {
if
(
sp
->
shutting_down
)
{
if
(
sp
->
shutting_down
)
{
/* During the shutdown case, we ARE expecting an error. So that's well,
/* During the shutdown case, we ARE expecting an error. So that's well,
and we can wake up the shutdown thread. */
and we can wake up the shutdown thread. */
sp
->
shutting_down
=
0
;
decrement_active_ports_and_notify
(
sp
);
sp
->
socket
->
read_info
.
outstanding
=
0
;
gpr_mu_lock
(
&
sp
->
server
->
mu
);
GPR_ASSERT
(
sp
->
server
->
active_ports
>
0
);
if
(
0
==
--
sp
->
server
->
active_ports
)
{
gpr_cv_broadcast
(
&
sp
->
server
->
cv
);
}
gpr_mu_unlock
(
&
sp
->
server
->
mu
);
return
;
return
;
}
else
{
}
else
{
char
*
utf8_message
=
gpr_format_message
(
WSAGetLastError
());
char
*
utf8_message
=
gpr_format_message
(
WSAGetLastError
());
...
...
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