summaryrefslogtreecommitdiff
path: root/libmanda.h
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2010-09-13 19:05:27 +0200
committerStefan Bühler <stbuehler@web.de>2010-09-13 19:05:27 +0200
commit78897a39b5c57b5441130b28bd83224227a9b117 (patch)
tree23c1dd2b71f47db79249fb31318b26d77332a64c /libmanda.h
parent3ab3fc6e6228cf4a79c382cfb11a7a67ecd68c12 (diff)
downloadlibmanda-master.tar.gz
libmanda-master.zip
Implement client connectionHEADmaster
Diffstat (limited to 'libmanda.h')
-rw-r--r--libmanda.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/libmanda.h b/libmanda.h
index f321a42..70140a7 100644
--- a/libmanda.h
+++ b/libmanda.h
@@ -166,7 +166,7 @@ void manda_server_drop_backend(manda_server_backend *backend); /* tell all users
typedef void (*manda_client_return_backend)(gpointer srv, manda_client_backend *backend);
/* backend will be free()d after the callback, don't keep the pointer; reason is NULL if the connection was closed */
-typedef void (*manda_client_lost_backend)(gpointer srv, manda_client_backend *backend, GString *reason);
+typedef void (*manda_client_lost_backend)(gpointer srv, manda_client_backend *backend, const GString *reason);
struct manda_client_backend_callbacks {
manda_client_return_backend return_backend;
@@ -181,24 +181,36 @@ struct manda_client_backend {
/* private from here */
const manda_client_backend_callbacks *callbacks;
- gboolean do_release;
+ guint32 id;
};
struct manda_client { /* private */
gint refcount;
gpointer data; /* application data */
+ gboolean closed;
const manda_async_ctrl *ctrl;
struct sockaddr *addr;
socklen_t addrlen;
+
+ manda_connection *con;
+
+ GPtrArray *backends; /* manda_client_backend* */
+
+ /* establish connection */
+ double last_connect_ts;
+ int sock_fd;
+ manda_fd_watcher sock_watcher;
};
manda_client* manda_client_new(gpointer srv, const manda_async_ctrl *ctrl, struct sockaddr *addr, socklen_t addrlen);
+void manda_client_close(manda_client *c);
void manda_client_acquire(manda_client *c);
void manda_client_release(manda_client *c);
-manda_client_backend* manda_client_bind_backend(manda_client *c, GString *name, const manda_client_backend_callbacks *callbacks);
-void manda_client_release_backend(manda_client *c, manda_client_backend *backend);
+manda_client_backend* manda_client_bind_backend(manda_client *c, GString *name, gpointer data, const manda_client_backend_callbacks *callbacks);
+void manda_client_release_backend(manda_client_backend *backend);
+void manda_client_update_backend(manda_client_backend *backend, guint32 load, guint32 workers);
#endif