diff options
author | Dan Winship <danw@src.gnome.org> | 2005-11-10 16:48:42 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2005-11-10 16:48:42 +0000 |
commit | 9781c6572877b6a2b83661073cf7932e4d54566b (patch) | |
tree | d43354b1a7692460514c516c3449c034cb642110 /libsoup/soup-server.c | |
parent | fda55879a793982bf069d399fce60c85380ad7b0 (diff) | |
download | libsoup-9781c6572877b6a2b83661073cf7932e4d54566b.tar.gz |
bump version to 2.2.90. This will not be officially released, but once
* configure.in: bump version to 2.2.90. This will not be
officially released, but once these patches have gotten some
testing they may be pulled up to the gnome-2-12 branch.
* libsoup/soup-connection.c:
* libsoup/soup-server.c:
* libsoup/soup-session.c:
* libsoup/soup-socket.c: add an "async-context" property,
which gets passed from server to socket, and session to connection
to socket, allowing async usage outside the main thread. Based on
patches from Armin Bauer and Jürg Billeter.
* libsoup/soup-misc.c (soup_add_io_watch, soup_add_idle,
soup_add_timeout): utility routines to add watches, idles, and
timeouts to non-default GMainContexts.
* libsoup/soup-message-io.c (io_write): set the read state
appropriately after writing a "100 Continue" response
(io_read): More 100-Continue stuff. I don't think this is quite
right so it will probably change again later.
Diffstat (limited to 'libsoup/soup-server.c')
-rw-r--r-- | libsoup/soup-server.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/libsoup/soup-server.c b/libsoup/soup-server.c index 22f62058..f64d7d34 100644 --- a/libsoup/soup-server.c +++ b/libsoup/soup-server.c @@ -42,6 +42,8 @@ typedef struct { GHashTable *handlers; /* KEY: path, VALUE: SoupServerHandler */ SoupServerHandler *default_handler; + + GMainContext *async_context; } SoupServerPrivate; #define SOUP_SERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_SERVER, SoupServerPrivate)) @@ -52,6 +54,7 @@ enum { PROP_INTERFACE, PROP_SSL_CERT_FILE, PROP_SSL_KEY_FILE, + PROP_ASYNC_CONTEXT, LAST_PROP }; @@ -124,6 +127,8 @@ finalize (GObject *object) if (priv->loop) g_main_loop_unref (priv->loop); + if (priv->async_context) + g_main_context_unref (priv->async_context); G_OBJECT_CLASS (soup_server_parent_class)->finalize (object); } @@ -169,6 +174,12 @@ soup_server_class_init (SoupServerClass *server_class) "File containing server SSL key", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property ( + object_class, PROP_ASYNC_CONTEXT, + g_param_spec_pointer (SOUP_SERVER_ASYNC_CONTEXT, + "Async GMainContext", + "The GMainContext to dispatch async I/O in", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } @@ -197,6 +208,11 @@ set_property (GObject *object, guint prop_id, priv->ssl_key_file = g_strdup (g_value_get_string (value)); break; + case PROP_ASYNC_CONTEXT: + priv->async_context = g_value_get_pointer (value); + if (priv->async_context) + g_main_context_ref (priv->async_context); + break; default: break; } @@ -221,6 +237,9 @@ get_property (GObject *object, guint prop_id, case PROP_SSL_KEY_FILE: g_value_set_string (value, g_strdup (priv->ssl_key_file)); break; + case PROP_ASYNC_CONTEXT: + g_value_set_pointer (value, priv->async_context ? g_main_context_ref (priv->async_context) : NULL); + break; default: break; } @@ -259,10 +278,10 @@ soup_server_new (const char *optname1, ...) } priv->listen_sock = - soup_socket_server_new (priv->interface, - priv->ssl_creds, - NULL, NULL); - if (!priv->listen_sock) { + soup_socket_new (SOUP_SOCKET_SSL_CREDENTIALS, priv->ssl_creds, + SOUP_SOCKET_ASYNC_CONTEXT, priv->async_context, + NULL); + if (!soup_socket_listen (priv->listen_sock, priv->interface)) { g_object_unref (server); return NULL; } @@ -486,7 +505,7 @@ soup_server_run (SoupServer *server) priv = SOUP_SERVER_GET_PRIVATE (server); if (!priv->loop) { - priv->loop = g_main_loop_new (NULL, TRUE); + priv->loop = g_main_loop_new (priv->async_context, TRUE); soup_server_run_async (server); } @@ -502,7 +521,9 @@ soup_server_quit (SoupServer *server) g_return_if_fail (SOUP_IS_SERVER (server)); priv = SOUP_SERVER_GET_PRIVATE (server); - g_main_loop_quit (priv->loop); + if (priv->loop) + g_main_loop_quit (priv->loop); + g_object_unref (server); } |