mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
Add setsockopt SO_REUSEADDR
Original commit message from CVS: Add setsockopt SO_REUSEADDR
This commit is contained in:
parent
db5fc95ca8
commit
3269b5d6d2
1 changed files with 6 additions and 0 deletions
|
@ -347,6 +347,7 @@ static gboolean
|
||||||
gst_udpsrc_init_receive (GstUDPSrc *src)
|
gst_udpsrc_init_receive (GstUDPSrc *src)
|
||||||
{
|
{
|
||||||
guint bc_val;
|
guint bc_val;
|
||||||
|
gint reuse=1;
|
||||||
bzero (&src->myaddr, sizeof (src->myaddr));
|
bzero (&src->myaddr, sizeof (src->myaddr));
|
||||||
src->myaddr.sin_family = AF_INET; /* host byte order */
|
src->myaddr.sin_family = AF_INET; /* host byte order */
|
||||||
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
||||||
|
@ -357,6 +358,11 @@ gst_udpsrc_init_receive (GstUDPSrc *src)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setsockopt(src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) {
|
||||||
|
perror("setsockopt");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (bind (src->sock, (struct sockaddr *) &src->myaddr, sizeof (src->myaddr)) == -1) {
|
if (bind (src->sock, (struct sockaddr *) &src->myaddr, sizeof (src->myaddr)) == -1) {
|
||||||
perror("bind");
|
perror("bind");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue