[dovecot-cvs] dovecot/src/imap client.c, 1.63, 1.64 client.h, 1.33,
1.34
cras at dovecot.org
cras at dovecot.org
Sun Jan 29 14:14:48 EET 2006
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv19474/imap
Modified Files:
client.c client.h
Log Message:
Call io_remove() before closing the fd. It's required by kqueue.
Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- client.c 14 Jan 2006 18:47:21 -0000 1.63
+++ client.c 29 Jan 2006 12:14:46 -0000 1.64
@@ -9,6 +9,7 @@
#include "namespace.h"
#include <stdlib.h>
+#include <unistd.h>
extern struct mail_storage_callbacks mail_storage_callbacks;
@@ -17,23 +18,26 @@
static int _client_output(void *context);
-struct client *client_create(int hin, int hout, struct namespace *namespaces)
+struct client *client_create(int fd_in, int fd_out,
+ struct namespace *namespaces)
{
struct client *client;
/* always use nonblocking I/O */
- net_set_nonblock(hin, TRUE);
- net_set_nonblock(hout, TRUE);
+ net_set_nonblock(fd_in, TRUE);
+ net_set_nonblock(fd_out, TRUE);
client = i_new(struct client, 1);
- client->input = i_stream_create_file(hin, default_pool,
+ client->fd_in = fd_in;
+ client->fd_out = fd_out;
+ client->input = i_stream_create_file(fd_in, default_pool,
imap_max_line_length, FALSE);
- client->output = o_stream_create_file(hout, default_pool,
+ client->output = o_stream_create_file(fd_out, default_pool,
(size_t)-1, FALSE);
o_stream_set_flush_callback(client->output, _client_output, client);
- client->io = io_add(hin, IO_READ, _client_input, client);
+ client->io = io_add(fd_in, IO_READ, _client_input, client);
client->parser = imap_parser_create(client->input, client->output,
imap_max_line_length);
client->last_input = ioloop_time;
@@ -87,6 +91,13 @@
i_stream_unref(&client->input);
o_stream_unref(&client->output);
+ if (close(client->fd_in) < 0)
+ i_error("close(client in) failed: %m");
+ if (client->fd_in != client->fd_out) {
+ if (close(client->fd_out) < 0)
+ i_error("close(client out) failed: %m");
+ }
+
pool_unref(client->keywords.pool);
pool_unref(client->cmd.pool);
i_free(client);
Index: client.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- client.h 14 Jan 2006 14:51:29 -0000 1.33
+++ client.h 29 Jan 2006 12:14:46 -0000 1.34
@@ -29,7 +29,7 @@
};
struct client {
- int socket;
+ int fd_in, fd_out;
struct io *io;
struct istream *input;
struct ostream *output;
@@ -57,7 +57,8 @@
/* Create new client with specified input/output handles. socket specifies
if the handle is a socket. */
-struct client *client_create(int hin, int hout, struct namespace *namespaces);
+struct client *client_create(int fd_in, int fd_out,
+ struct namespace *namespaces);
void client_destroy(struct client *client);
/* Disconnect client connection */
More information about the dovecot-cvs
mailing list