[dovecot-cvs] dovecot/src/login-common login-proxy.c,1.4,1.5
cras at dovecot.org
cras at dovecot.org
Fri Jan 7 14:40:43 EET 2005
Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv6977
Modified Files:
login-proxy.c
Log Message:
s/proxy/server/ for variables describing remote server.
Index: login-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/login-proxy.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- login-proxy.c 20 Oct 2004 17:07:33 -0000 1.4
+++ login-proxy.c 7 Jan 2005 12:40:40 -0000 1.5
@@ -12,10 +12,10 @@
#define OUTBUF_THRESHOLD 1024
struct login_proxy {
- int client_fd, proxy_fd;
- struct io *client_io, *proxy_io;
- struct istream *proxy_input;
- struct ostream *client_output, *proxy_output;
+ int client_fd, server_fd;
+ struct io *client_io, *server_io;
+ struct istream *server_input;
+ struct ostream *client_output, *server_output;
char *host, *user;
unsigned int port;
@@ -28,7 +28,7 @@
static struct hash_table *login_proxies;
-static void proxy_input(void *context)
+static void server_input(void *context)
{
struct login_proxy *proxy = context;
unsigned char buf[OUTBUF_THRESHOLD];
@@ -38,12 +38,12 @@
OUTBUF_THRESHOLD) {
/* client's output buffer is already quite full.
don't send more until we're below threshold. */
- io_remove(proxy->proxy_io);
- proxy->proxy_io = NULL;
+ io_remove(proxy->server_io);
+ proxy->server_io = NULL;
return;
}
- ret = net_receive(proxy->proxy_fd, buf, sizeof(buf));
+ ret = net_receive(proxy->server_fd, buf, sizeof(buf));
if (ret > 0)
(void)o_stream_send(proxy->client_output, buf, ret);
else if (ret < 0)
@@ -56,7 +56,7 @@
unsigned char buf[OUTBUF_THRESHOLD];
ssize_t ret;
- if (o_stream_get_buffer_used_size(proxy->proxy_output) >
+ if (o_stream_get_buffer_used_size(proxy->server_output) >
OUTBUF_THRESHOLD) {
/* proxy's output buffer is already quite full.
don't send more until we're below threshold. */
@@ -67,22 +67,22 @@
ret = net_receive(proxy->client_fd, buf, sizeof(buf));
if (ret > 0)
- (void)o_stream_send(proxy->proxy_output, buf, ret);
+ (void)o_stream_send(proxy->server_output, buf, ret);
else if (ret < 0)
login_proxy_free(proxy);
}
-static int proxy_output(void *context)
+static int server_output(void *context)
{
struct login_proxy *proxy = context;
- if (o_stream_flush(proxy->proxy_output) < 0) {
+ if (o_stream_flush(proxy->server_output) < 0) {
login_proxy_free(proxy);
return 1;
}
if (proxy->client_io == NULL &&
- o_stream_get_buffer_used_size(proxy->proxy_output) <
+ o_stream_get_buffer_used_size(proxy->server_output) <
OUTBUF_THRESHOLD) {
/* there's again space in proxy's output buffer, so we can
read more from client. */
@@ -101,13 +101,13 @@
return 1;
}
- if (proxy->proxy_io == NULL &&
+ if (proxy->server_io == NULL &&
o_stream_get_buffer_used_size(proxy->client_output) <
OUTBUF_THRESHOLD) {
/* there's again space in client's output buffer, so we can
read more from proxy. */
- proxy->proxy_io =
- io_add(proxy->proxy_fd, IO_READ, proxy_input, proxy);
+ proxy->server_io =
+ io_add(proxy->server_fd, IO_READ, server_input, proxy);
}
return 1;
}
@@ -116,7 +116,7 @@
{
struct login_proxy *proxy = context;
- proxy->callback(proxy->proxy_input, proxy->proxy_output,
+ proxy->callback(proxy->server_input, proxy->server_output,
proxy->context);
}
@@ -125,7 +125,7 @@
struct login_proxy *proxy = context;
int err;
- err = net_geterror(proxy->proxy_fd);
+ err = net_geterror(proxy->server_fd);
if (err != 0) {
i_error("proxy: connect(%s, %u) failed: %s",
proxy->host, proxy->port, strerror(err));
@@ -134,16 +134,16 @@
}
/* connect successful */
- proxy->proxy_input =
- i_stream_create_file(proxy->proxy_fd, default_pool,
+ proxy->server_input =
+ i_stream_create_file(proxy->server_fd, default_pool,
MAX_PROXY_INPUT_SIZE, FALSE);
- proxy->proxy_output =
- o_stream_create_file(proxy->proxy_fd, default_pool,
+ proxy->server_output =
+ o_stream_create_file(proxy->server_fd, default_pool,
(size_t)-1, FALSE);
- io_remove(proxy->proxy_io);
- proxy->proxy_io =
- io_add(proxy->proxy_fd, IO_READ, proxy_prelogin_input, proxy);
+ io_remove(proxy->server_io);
+ proxy->server_io =
+ io_add(proxy->server_fd, IO_READ, proxy_prelogin_input, proxy);
}
struct login_proxy *
@@ -177,8 +177,8 @@
proxy->user = i_strdup(client->virtual_user);
proxy->port = port;
- proxy->proxy_fd = fd;
- proxy->proxy_io = io_add(fd, IO_WRITE, proxy_wait_connect, proxy);
+ proxy->server_fd = fd;
+ proxy->server_io = io_add(fd, IO_WRITE, proxy_wait_connect, proxy);
proxy->callback = callback;
proxy->context = context;
@@ -214,13 +214,13 @@
proxy->callback(NULL, NULL, proxy->context);
}
- if (proxy->proxy_io != NULL)
- io_remove(proxy->proxy_io);
- if (proxy->proxy_input != NULL)
- i_stream_unref(proxy->proxy_input);
- if (proxy->proxy_output != NULL)
- o_stream_unref(proxy->proxy_output);
- net_disconnect(proxy->proxy_fd);
+ if (proxy->server_io != NULL)
+ io_remove(proxy->server_io);
+ if (proxy->server_input != NULL)
+ i_stream_unref(proxy->server_input);
+ if (proxy->server_output != NULL)
+ o_stream_unref(proxy->server_output);
+ net_disconnect(proxy->server_fd);
i_free(proxy->host);
i_free(proxy->user);
@@ -242,18 +242,18 @@
/* send all pending client input to proxy and get rid of the stream */
data = i_stream_get_data(client_input, &size);
if (size != 0)
- (void)o_stream_send(proxy->proxy_output, data, size);
+ (void)o_stream_send(proxy->server_output, data, size);
i_stream_unref(client_input);
/* from now on, just do dummy proxying */
- io_remove(proxy->proxy_io);
- proxy->proxy_io = io_add(proxy->proxy_fd, IO_READ, proxy_input, proxy);
+ io_remove(proxy->server_io);
+ proxy->server_io = io_add(proxy->server_fd, IO_READ, server_input, proxy);
proxy->client_io = io_add(proxy->client_fd, IO_READ,
proxy_client_input, proxy);
- o_stream_set_flush_callback(proxy->proxy_output, proxy_output, proxy);
+ o_stream_set_flush_callback(proxy->server_output, server_output, proxy);
- i_stream_unref(proxy->proxy_input);
- proxy->proxy_input = NULL;
+ i_stream_unref(proxy->server_input);
+ proxy->server_input = NULL;
if (login_proxies == NULL) {
login_proxies = hash_create(default_pool, default_pool,
More information about the dovecot-cvs
mailing list