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
d112ed94
Commit
d112ed94
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Further safety fixes for TCP on Windows
parent
cbafdd10
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/lib/iomgr/socket_windows.c
+8
-0
8 additions, 0 deletions
src/core/lib/iomgr/socket_windows.c
src/core/lib/iomgr/socket_windows.h
+1
-0
1 addition, 0 deletions
src/core/lib/iomgr/socket_windows.h
src/core/lib/iomgr/tcp_client_windows.c
+14
-10
14 additions, 10 deletions
src/core/lib/iomgr/tcp_client_windows.c
with
23 additions
and
10 deletions
src/core/lib/iomgr/socket_windows.c
+
8
−
0
View file @
d112ed94
...
...
@@ -76,6 +76,14 @@ void grpc_winsocket_shutdown(grpc_winsocket *winsocket) {
LPFN_DISCONNECTEX
DisconnectEx
;
DWORD
ioctl_num_bytes
;
gpr_mu_lock
(
&
winsocket
->
state_mu
);
if
(
winsocket
->
shutdown_called
)
{
gpr_mu_unlock
(
&
winsocket
->
state_mu
);
return
;
}
winsocket
->
shutdown_called
=
true
;
gpr_mu_unlock
(
&
winsocket
->
state_mu
);
status
=
WSAIoctl
(
winsocket
->
socket
,
SIO_GET_EXTENSION_FUNCTION_POINTER
,
&
guid
,
sizeof
(
guid
),
&
DisconnectEx
,
sizeof
(
DisconnectEx
),
&
ioctl_num_bytes
,
NULL
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/socket_windows.h
+
1
−
0
View file @
d112ed94
...
...
@@ -87,6 +87,7 @@ typedef struct grpc_winsocket {
grpc_winsocket_callback_info
read_info
;
gpr_mu
state_mu
;
bool
shutdown_called
;
/* You can't add the same socket twice to the same IO Completion Port.
This prevents that. */
...
...
This diff is collapsed.
Click to expand it.
src/core/lib/iomgr/tcp_client_windows.c
+
14
−
10
View file @
d112ed94
...
...
@@ -107,18 +107,22 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) {
gpr_mu_lock
(
&
ac
->
mu
);
if
(
error
==
GRPC_ERROR_NONE
&&
socket
!=
NULL
)
{
DWORD
transfered_bytes
=
0
;
DWORD
flags
;
BOOL
wsa_success
=
if
(
error
==
GRPC_ERROR_NONE
)
{
if
(
socket
!=
NULL
)
{
DWORD
transfered_bytes
=
0
;
DWORD
flags
;
BOOL
wsa_success
=
WSAGetOverlappedResult
(
socket
->
socket
,
&
socket
->
write_info
.
overlapped
,
&
transfered_bytes
,
FALSE
,
&
flags
);
GPR_ASSERT
(
transfered_bytes
==
0
);
if
(
!
wsa_success
)
{
error
=
GRPC_WSA_ERROR
(
WSAGetLastError
(),
"ConnectEx"
);
&
transfered_bytes
,
FALSE
,
&
flags
);
GPR_ASSERT
(
transfered_bytes
==
0
);
if
(
!
wsa_success
)
{
error
=
GRPC_WSA_ERROR
(
WSAGetLastError
(),
"ConnectEx"
);
}
else
{
*
ep
=
grpc_tcp_create
(
socket
,
ac
->
resource_quota
,
ac
->
addr_name
);
socket
=
NULL
;
}
}
else
{
*
ep
=
grpc_tcp_create
(
socket
,
ac
->
resource_quota
,
ac
->
addr_name
);
socket
=
NULL
;
error
=
GRPC_ERROR_CREATE
(
"socket is null"
);
}
}
...
...
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