diff options
author | Dan Winship <danw@src.gnome.org> | 2003-09-09 15:33:48 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2003-09-09 15:33:48 +0000 |
commit | 1dc7f62613ce0bf9fbb2d04f05aa62b874278ebb (patch) | |
tree | 6009a2c66213cf8b9f53ffb5263a4f6117bc1fda /libsoup/soup-socket.h | |
parent | 890c881ba66dda669a4fc48bb7707ceafe6dac29 (diff) | |
download | libsoup-1dc7f62613ce0bf9fbb2d04f05aa62b874278ebb.tar.gz |
Beginnings of improved synchronous API support
* libsoup/soup-dns.c: Simplify this by making it not automatically
return the result: force the caller to poll. (This isn't really a
performance issue: the results should come back quickly anyway.)
Also, make the cache thread-safe.
(soup_dns_entry_from_name): Was soup_gethostbyname
(soup_dns_entry_from_addr): Was soup_gethostbyaddr
(soup_dns_entry_check_lookup): Used to poll to see if DNS is done
(soup_dns_entry_get_hostent): Gets the hostent from an entry (and
blocks if it's not resolved yet).
* libsoup/soup-address.c: Update for soup-dns changes.
(soup_address_new): Don't automatically start resolving the
hostname now, since we don't know if the caller is going to want
it resolved synchronously or asynchronously.
(soup_address_resolve_async): Renamed from soup_address_resolve.
(soup_address_resolve_sync): New routine to do blocking
synchronous DNS.
* libsoup/soup-socket.c (soup_socket_connect): Now returns a
status value directly when connecting synchronously.
(soup_socket_client_new_async, soup_socket_client_new_sync):
Separate async/sync client socket functions.
(soup_socket_get_iochannel): Made static since it was not used
outside soup-socket.
* libsoup/soup-connection.c (soup_connection_new,
soup_connection_new_proxy, soup_connection_new_tunnel): Just set
up the data, don't actually start connecting.
(soup_connection_connect_async, soup_connection_connect_sync): New
async and sync SoupConnection connecting routines.
(soup_connection_get_socket): Remove this since it wasn't being
used.
* libsoup/soup-session.c (final_finished): Run the queue since a
connection is now freed up.
(run_queue): Update for soup_connection_new* changes.
* libsoup/soup-misc.c (soup_substring_index): Remove, since it
wasn't being used any more.
* libsoup/soup-private.h: Remove some prototypes for functions
that no longer exist.
* libsoup/soup-uri.c (soup_uri_copy_root): New utility function
(copies the protocol, host, and port of a SoupUri).
* tests/auth-test.c:
* tests/get.c:
* tests/simple-proxy.c: belatedly update for soup-session change
* tests/revserver.c: Handle each new connection in its own thread,
using synchronous SoupSocket calls.
Diffstat (limited to 'libsoup/soup-socket.h')
-rw-r--r-- | libsoup/soup-socket.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libsoup/soup-socket.h b/libsoup/soup-socket.h index fd21fb85..5b3e49fe 100644 --- a/libsoup/soup-socket.h +++ b/libsoup/soup-socket.h @@ -35,20 +35,20 @@ typedef struct { void (*new_connection) (SoupSocket *, SoupSocket *); } SoupSocketClass; -typedef enum { - SOUP_SOCKET_FLAG_NONBLOCKING, - SOUP_SOCKET_FLAG_NODELAY, - SOUP_SOCKET_FLAG_REUSEADDR, -} SoupSocketFlag; +#define SOUP_SOCKET_FLAG_NONBLOCKING (1<<0) +#define SOUP_SOCKET_FLAG_NODELAY (1<<1) +#define SOUP_SOCKET_FLAG_SERVER (1<<2) +#define SOUP_SOCKET_FLAG_REUSEADDR (1<<3) +#define SOUP_SOCKET_FLAG_ALL ( ~0 ) GType soup_socket_get_type (void); SoupSocket *soup_socket_new (void); -void soup_socket_set_flag (SoupSocket *sock, - SoupSocketFlag flag, - gboolean value); +void soup_socket_set_flags (SoupSocket *sock, + guint mask, + guint flags); -void soup_socket_connect (SoupSocket *sock, +guint soup_socket_connect (SoupSocket *sock, SoupAddress *rem_addr); gboolean soup_socket_listen (SoupSocket *sock, SoupAddress *local_addr); @@ -64,19 +64,20 @@ typedef void (*SoupSocketListenerCallback) (SoupSocket *listener, SoupSocket *sock, gpointer user_data); -SoupSocket *soup_socket_client_new (const char *hostname, +SoupSocket *soup_socket_client_new_async (const char *hostname, guint port, gboolean ssl, SoupSocketCallback callback, gpointer user_data); +SoupSocket *soup_socket_client_new_sync (const char *hostname, + guint port, + gboolean ssl, + guint *status); SoupSocket *soup_socket_server_new (SoupAddress *local_addr, gboolean ssl, SoupSocketListenerCallback, gpointer user_data); - -GIOChannel *soup_socket_get_iochannel (SoupSocket *sock); - SoupAddress *soup_socket_get_local_address (SoupSocket *sock); SoupAddress *soup_socket_get_remote_address (SoupSocket *sock); |