Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
c84fb68c
Commit
c84fb68c
authored
Mar 14, 2013
by
Simon Morlat
Browse files
add SO_REUSEADDR
parent
ad5124f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
src/transports/udp_listeningpoint.c
src/transports/udp_listeningpoint.c
+8
-0
No files found.
src/transports/udp_listeningpoint.c
View file @
c84fb68c
...
...
@@ -64,6 +64,7 @@ static belle_sip_socket_t create_udp_socket(const char *addr, int port, int *fam
int
err
;
belle_sip_socket_t
sock
;
char
portnum
[
10
];
int
optval
=
1
;
snprintf
(
portnum
,
sizeof
(
portnum
),
"%i"
,
port
);
hints
.
ai_family
=
AF_UNSPEC
;
...
...
@@ -82,6 +83,13 @@ static belle_sip_socket_t create_udp_socket(const char *addr, int port, int *fam
freeaddrinfo
(
res
);
return
-
1
;
}
err
=
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
optval
,
sizeof
(
optval
));
if
(
err
==-
1
)
{
belle_sip_warning
(
"Fail to set SIP/UDP address reusable: %s."
,
belle_sip_get_socket_error_string
());
}
err
=
bind
(
sock
,
res
->
ai_addr
,
res
->
ai_addrlen
);
if
(
err
==-
1
){
belle_sip_error
(
"udp bind() failed for %s port %i: %s"
,
addr
,
port
,
belle_sip_get_socket_error_string
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment