[libsoup/wip/server-steal: 2/3] soup-socket: add flag close-on-dispose to SoupSocket
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/wip/server-steal: 2/3] soup-socket: add flag close-on-dispose to SoupSocket
- Date: Wed, 22 Jan 2014 16:52:15 +0000 (UTC)
commit e09e9a15cd87dfc4e0738886e28c9690c4239e2d
Author: Dirkjan Ochtman <dirkjan ochtman nl>
Date: Mon Jan 6 08:42:00 2014 -0500
soup-socket: add flag close-on-dispose to SoupSocket
https://bugzilla.gnome.org/show_bug.cgi?id=721343
libsoup/soup-misc-private.h | 1 +
libsoup/soup-socket.c | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-misc-private.h b/libsoup/soup-misc-private.h
index 50a3b98..5c41d5e 100644
--- a/libsoup/soup-misc-private.h
+++ b/libsoup/soup-misc-private.h
@@ -46,6 +46,7 @@ GIOStream *soup_socket_get_iostream (SoupSocket *sock);
#define SOUP_SOCKET_CLEAN_DISPOSE "clean-dispose"
#define SOUP_SOCKET_PROXY_RESOLVER "proxy-resolver"
+#define SOUP_SOCKET_CLOSE_ON_DISPOSE "close-on-dispose"
SoupURI *soup_socket_get_http_proxy_uri (SoupSocket *sock);
/* At some point it might be possible to mark additional methods
diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
index e0748fd..ecd2324 100644
--- a/libsoup/soup-socket.c
+++ b/libsoup/soup-socket.c
@@ -60,6 +60,7 @@ enum {
PROP_TLS_CERTIFICATE,
PROP_TLS_ERRORS,
PROP_PROXY_RESOLVER,
+ PROP_CLOSE_ON_DISPOSE,
LAST_PROP
};
@@ -79,6 +80,7 @@ typedef struct {
guint ssl_strict:1;
guint ssl_fallback:1;
guint clean_dispose:1;
+ guint close_on_dispose:1;
guint use_thread_context:1;
gpointer ssl_creds;
@@ -136,7 +138,7 @@ soup_socket_finalize (GObject *object)
g_warning ("Disposing socket %p during connect", object);
g_object_unref (priv->connect_cancel);
}
- if (priv->gsock) {
+ if (priv->gsock && priv->close_on_dispose) {
if (priv->clean_dispose)
g_warning ("Disposing socket %p while still connected", object);
disconnect_internal (SOUP_SOCKET (object), TRUE);
@@ -229,6 +231,9 @@ soup_socket_set_property (GObject *object, guint prop_id,
case PROP_CLEAN_DISPOSE:
priv->clean_dispose = g_value_get_boolean (value);
break;
+ case PROP_CLOSE_ON_DISPOSE:
+ priv->close_on_dispose = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -287,6 +292,9 @@ soup_socket_get_property (GObject *object, guint prop_id,
case PROP_PROXY_RESOLVER:
g_value_set_object (value, priv->proxy_resolver);
break;
+ case PROP_CLOSE_ON_DISPOSE:
+ g_value_set_boolean (value, priv->close_on_dispose);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -628,6 +636,14 @@ soup_socket_class_init (SoupSocketClass *socket_class)
"GProxyResolver to use",
G_TYPE_PROXY_RESOLVER,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class, PROP_CLOSE_ON_DISPOSE,
+ g_param_spec_boolean (SOUP_SOCKET_CLOSE_ON_DISPOSE,
+ "Close socket on disposal",
+ "Whether the socket is closed on disposal",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]