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
9aa4f1b0
Commit
9aa4f1b0
authored
9 years ago
by
yang-g
Browse files
Options
Downloads
Patches
Plain Diff
fix windows leaks
parent
180ca863
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/core/iomgr/iocp_windows.c
+9
-5
9 additions, 5 deletions
src/core/iomgr/iocp_windows.c
src/core/iomgr/iocp_windows.h
+9
-2
9 additions, 2 deletions
src/core/iomgr/iocp_windows.h
src/core/iomgr/tcp_server_windows.c
+1
-2
1 addition, 2 deletions
src/core/iomgr/tcp_server_windows.c
with
19 additions
and
9 deletions
src/core/iomgr/iocp_windows.c
+
9
−
5
View file @
9aa4f1b0
...
@@ -71,7 +71,8 @@ static DWORD deadline_to_millis_timeout(gpr_timespec deadline,
...
@@ -71,7 +71,8 @@ static DWORD deadline_to_millis_timeout(gpr_timespec deadline,
timeout
,
gpr_time_from_nanos
(
GPR_NS_PER_MS
-
1
,
GPR_TIMESPAN
)));
timeout
,
gpr_time_from_nanos
(
GPR_NS_PER_MS
-
1
,
GPR_TIMESPAN
)));
}
}
void
grpc_iocp_work
(
grpc_exec_ctx
*
exec_ctx
,
gpr_timespec
deadline
)
{
grpc_iocp_work_status
grpc_iocp_work
(
grpc_exec_ctx
*
exec_ctx
,
gpr_timespec
deadline
)
{
BOOL
success
;
BOOL
success
;
DWORD
bytes
=
0
;
DWORD
bytes
=
0
;
DWORD
flags
=
0
;
DWORD
flags
=
0
;
...
@@ -84,14 +85,14 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
...
@@ -84,14 +85,14 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
g_iocp
,
&
bytes
,
&
completion_key
,
&
overlapped
,
g_iocp
,
&
bytes
,
&
completion_key
,
&
overlapped
,
deadline_to_millis_timeout
(
deadline
,
gpr_now
(
deadline
.
clock_type
)));
deadline_to_millis_timeout
(
deadline
,
gpr_now
(
deadline
.
clock_type
)));
if
(
success
==
0
&&
overlapped
==
NULL
)
{
if
(
success
==
0
&&
overlapped
==
NULL
)
{
return
;
return
GRPC_IOCP_WORK_TIMEOUT
;
}
}
GPR_ASSERT
(
completion_key
&&
overlapped
);
GPR_ASSERT
(
completion_key
&&
overlapped
);
if
(
overlapped
==
&
g_iocp_custom_overlap
)
{
if
(
overlapped
==
&
g_iocp_custom_overlap
)
{
gpr_atm_full_fetch_add
(
&
g_custom_events
,
-
1
);
gpr_atm_full_fetch_add
(
&
g_custom_events
,
-
1
);
if
(
completion_key
==
(
ULONG_PTR
)
&
g_iocp_kick_token
)
{
if
(
completion_key
==
(
ULONG_PTR
)
&
g_iocp_kick_token
)
{
/* We were awoken from a kick. */
/* We were awoken from a kick. */
return
;
return
GRPC_IOCP_WORK_KICK
;
}
}
gpr_log
(
GPR_ERROR
,
"Unknown custom completion key."
);
gpr_log
(
GPR_ERROR
,
"Unknown custom completion key."
);
abort
();
abort
();
...
@@ -121,6 +122,7 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
...
@@ -121,6 +122,7 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
}
}
gpr_mu_unlock
(
&
socket
->
state_mu
);
gpr_mu_unlock
(
&
socket
->
state_mu
);
grpc_exec_ctx_enqueue
(
exec_ctx
,
closure
,
true
,
NULL
);
grpc_exec_ctx_enqueue
(
exec_ctx
,
closure
,
true
,
NULL
);
return
GRPC_IOCP_WORK_WORK
;
}
}
void
grpc_iocp_init
(
void
)
{
void
grpc_iocp_init
(
void
)
{
...
@@ -140,10 +142,12 @@ void grpc_iocp_kick(void) {
...
@@ -140,10 +142,12 @@ void grpc_iocp_kick(void) {
void
grpc_iocp_flush
(
void
)
{
void
grpc_iocp_flush
(
void
)
{
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_exec_ctx
exec_ctx
=
GRPC_EXEC_CTX_INIT
;
grpc_iocp_work_status
work_status
;
do
{
do
{
grpc_iocp_work
(
&
exec_ctx
,
gpr_inf_past
(
GPR_CLOCK_MONOTONIC
));
work_status
=
grpc_iocp_work
(
&
exec_ctx
,
gpr_inf_past
(
GPR_CLOCK_MONOTONIC
));
}
while
(
grpc_exec_ctx_flush
(
&
exec_ctx
));
}
while
(
work_status
==
GRPC_IOCP_WORK_KICK
||
grpc_exec_ctx_flush
(
&
exec_ctx
));
}
}
void
grpc_iocp_shutdown
(
void
)
{
void
grpc_iocp_shutdown
(
void
)
{
...
...
This diff is collapsed.
Click to expand it.
src/core/iomgr/iocp_windows.h
+
9
−
2
View file @
9aa4f1b0
/*
/*
*
*
* Copyright 2015, Google Inc.
* Copyright 2015
-2016
, Google Inc.
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
...
@@ -38,7 +38,14 @@
...
@@ -38,7 +38,14 @@
#include
"src/core/iomgr/socket_windows.h"
#include
"src/core/iomgr/socket_windows.h"
void
grpc_iocp_work
(
grpc_exec_ctx
*
exec_ctx
,
gpr_timespec
deadline
);
typedef
enum
{
GRPC_IOCP_WORK_WORK
,
GRPC_IOCP_WORK_TIMEOUT
,
GRPC_IOCP_WORK_KICK
}
grpc_iocp_work_status
;
grpc_iocp_work_status
grpc_iocp_work
(
grpc_exec_ctx
*
exec_ctx
,
gpr_timespec
deadline
);
void
grpc_iocp_init
(
void
);
void
grpc_iocp_init
(
void
);
void
grpc_iocp_kick
(
void
);
void
grpc_iocp_kick
(
void
);
void
grpc_iocp_flush
(
void
);
void
grpc_iocp_flush
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/core/iomgr/tcp_server_windows.c
+
1
−
2
View file @
9aa4f1b0
...
@@ -240,8 +240,7 @@ static void decrement_active_ports_and_notify(grpc_exec_ctx *exec_ctx,
...
@@ -240,8 +240,7 @@ static void decrement_active_ports_and_notify(grpc_exec_ctx *exec_ctx,
sp
->
shutting_down
=
0
;
sp
->
shutting_down
=
0
;
gpr_mu_lock
(
&
sp
->
server
->
mu
);
gpr_mu_lock
(
&
sp
->
server
->
mu
);
GPR_ASSERT
(
sp
->
server
->
active_ports
>
0
);
GPR_ASSERT
(
sp
->
server
->
active_ports
>
0
);
if
(
0
==
--
sp
->
server
->
active_ports
&&
if
(
0
==
--
sp
->
server
->
active_ports
)
{
sp
->
server
->
shutdown_complete
!=
NULL
)
{
notify
=
1
;
notify
=
1
;
}
}
gpr_mu_unlock
(
&
sp
->
server
->
mu
);
gpr_mu_unlock
(
&
sp
->
server
->
mu
);
...
...
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