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
28fa2625
Commit
28fa2625
authored
10 years ago
by
David Klempner
Browse files
Options
Downloads
Plain Diff
Merge pull request #560 from ctiller/uds
UDS Fix
parents
f06afdee
aa31da4f
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_posix.c
+18
-5
18 additions, 5 deletions
src/core/iomgr/tcp_server_posix.c
with
18 additions
and
5 deletions
src/core/iomgr/tcp_server_posix.c
+
18
−
5
View file @
28fa2625
...
@@ -42,17 +42,18 @@
...
@@ -42,17 +42,18 @@
#include
"src/core/iomgr/tcp_server.h"
#include
"src/core/iomgr/tcp_server.h"
#include
<
limits
.h>
#include
<
errno
.h>
#include
<fcntl.h>
#include
<fcntl.h>
#include
<limits.h>
#include
<netinet/in.h>
#include
<netinet/in.h>
#include
<netinet/tcp.h>
#include
<netinet/tcp.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<string.h>
#include
<sys/socket.h>
#include
<sys/stat.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<sys/un.h>
#include
<sys/un.h>
#include
<sys/socket.h>
#include
<unistd.h>
#include
<unistd.h>
#include
<string.h>
#include
<errno.h>
#include
"src/core/iomgr/pollset_posix.h"
#include
"src/core/iomgr/pollset_posix.h"
#include
"src/core/iomgr/resolve_address.h"
#include
"src/core/iomgr/resolve_address.h"
...
@@ -83,6 +84,14 @@ typedef struct {
...
@@ -83,6 +84,14 @@ typedef struct {
int
addr_len
;
int
addr_len
;
}
server_port
;
}
server_port
;
static
void
unlink_if_unix_domain_socket
(
const
struct
sockaddr_un
*
un
)
{
struct
stat
st
;
if
(
stat
(
un
->
sun_path
,
&
st
)
==
0
&&
(
st
.
st_mode
&
S_IFMT
)
==
S_IFSOCK
)
{
unlink
(
un
->
sun_path
);
}
}
/* the overall server */
/* the overall server */
struct
grpc_tcp_server
{
struct
grpc_tcp_server
{
grpc_tcp_server_cb
cb
;
grpc_tcp_server_cb
cb
;
...
@@ -130,7 +139,7 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) {
...
@@ -130,7 +139,7 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) {
for
(
i
=
0
;
i
<
s
->
nports
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nports
;
i
++
)
{
server_port
*
sp
=
&
s
->
ports
[
i
];
server_port
*
sp
=
&
s
->
ports
[
i
];
if
(
sp
->
addr
.
sockaddr
.
sa_family
==
AF_UNIX
)
{
if
(
sp
->
addr
.
sockaddr
.
sa_family
==
AF_UNIX
)
{
unlink
(
sp
->
addr
.
un
.
sun_path
);
unlink
_if_unix_domain_socket
(
&
sp
->
addr
.
un
);
}
}
grpc_fd_orphan
(
sp
->
emfd
,
NULL
,
NULL
);
grpc_fd_orphan
(
sp
->
emfd
,
NULL
,
NULL
);
}
}
...
@@ -301,6 +310,10 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
...
@@ -301,6 +310,10 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
socklen_t
sockname_len
;
socklen_t
sockname_len
;
int
port
;
int
port
;
if
(((
struct
sockaddr
*
)
addr
)
->
sa_family
==
AF_UNIX
)
{
unlink_if_unix_domain_socket
(
addr
);
}
/* Check if this is a wildcard port, and if so, try to keep the port the same
/* Check if this is a wildcard port, and if so, try to keep the port the same
as some previously created listener. */
as some previously created listener. */
if
(
grpc_sockaddr_get_port
(
addr
)
==
0
)
{
if
(
grpc_sockaddr_get_port
(
addr
)
==
0
)
{
...
...
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