mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 05:16:18 +01:00
Merge branch 'ip_bind_address_no_port' into 'master'
gsocketclient: set IP_BIND_ADDRESS_NO_PORT if binding to local address See merge request GNOME/glib!1598
This commit is contained in:
commit
497ea1a420
@ -24,6 +24,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gsocketclient.h"
|
#include "gsocketclient.h"
|
||||||
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -39,6 +43,7 @@
|
|||||||
#include <gio/gioerror.h>
|
#include <gio/gioerror.h>
|
||||||
#include <gio/gsocket.h>
|
#include <gio/gsocket.h>
|
||||||
#include <gio/gnetworkaddress.h>
|
#include <gio/gnetworkaddress.h>
|
||||||
|
#include <gio/gnetworking.h>
|
||||||
#include <gio/gnetworkservice.h>
|
#include <gio/gnetworkservice.h>
|
||||||
#include <gio/gproxy.h>
|
#include <gio/gproxy.h>
|
||||||
#include <gio/gproxyresolver.h>
|
#include <gio/gproxyresolver.h>
|
||||||
@ -142,6 +147,10 @@ create_socket (GSocketClient *client,
|
|||||||
|
|
||||||
if (client->priv->local_address)
|
if (client->priv->local_address)
|
||||||
{
|
{
|
||||||
|
#ifdef IP_BIND_ADDRESS_NO_PORT
|
||||||
|
g_socket_set_option (socket, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, 1, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!g_socket_bind (socket,
|
if (!g_socket_bind (socket,
|
||||||
client->priv->local_address,
|
client->priv->local_address,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
Loading…
Reference in New Issue
Block a user