[dovecot-cvs]
dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.16,
1.17 mbox-lock.c, 1.9, 1.10 mbox-save.c, 1.56, 1.57
cras at dovecot.org
cras at dovecot.org
Sun Aug 15 06:40:34 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c,
1.36, 1.37
- Next message: [dovecot-cvs] dovecot/src/lib Makefile.am, 1.39, 1.40 alarm-hup.c,
1.6, NONE alarm-hup.h, 1.1, NONE file-lock.c, 1.8,
1.9 iostream-internal.h, 1.4, 1.5 iostream.c, 1.5,
1.6 istream-data.c, 1.8, 1.9 istream-file.c, 1.17,
1.18 istream-limit.c, 1.6, 1.7 istream-mmap.c, 1.11,
1.12 istream.c, 1.19, 1.20 istream.h, 1.10, 1.11 lib.c, 1.10,
1.11 ostream-file.c, 1.27, 1.28 ostream-internal.h, 1.2,
1.3 ostream.c, 1.8, 1.9 ostream.h, 1.8, 1.9 strfuncs.c, 1.41,
1.42 strfuncs.h, 1.20, 1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv20173/lib-storage/index/mbox
Modified Files:
istream-raw-mbox.c mbox-lock.c mbox-save.c
Log Message:
We never do blocking reads/writes to network anymore. Changed imap and pop3
processes to use a single I/O loop.
Not much tested yet, and currently LIST/LSUB may eat too much memory and
APPEND eats all CPU.
Index: istream-raw-mbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- istream-raw-mbox.c 26 Jul 2004 14:49:01 -0000 1.16
+++ istream-raw-mbox.c 15 Aug 2004 03:40:32 -0000 1.17
@@ -40,15 +40,6 @@
i_stream_set_max_buffer_size(rstream->input, max_size);
}
-static void _set_blocking(struct _iostream *stream, int timeout_msecs,
- void (*timeout_cb)(void *), void *context)
-{
- struct raw_mbox_istream *rstream = (struct raw_mbox_istream *)stream;
-
- i_stream_set_blocking(rstream->input, timeout_msecs,
- timeout_cb, context);
-}
-
static int mbox_read_from_line(struct raw_mbox_istream *rstream)
{
const unsigned char *buf, *p;
@@ -298,7 +289,6 @@
rstream->istream.iostream.close = _close;
rstream->istream.iostream.destroy = _destroy;
rstream->istream.iostream.set_max_buffer_size = _set_max_buffer_size;
- rstream->istream.iostream.set_blocking = _set_blocking;
rstream->istream.read = _read;
rstream->istream.seek = _seek;
Index: mbox-lock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-lock.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mbox-lock.c 20 Jun 2004 11:17:53 -0000 1.9
+++ mbox-lock.c 15 Aug 2004 03:40:32 -0000 1.10
@@ -347,6 +347,7 @@
{
struct flock fl;
time_t now;
+ unsigned int next_alarm;
int wait_type;
if (mbox_file_open_latest(ctx, lock_type) < 0)
@@ -361,23 +362,40 @@
fl.l_start = 0;
fl.l_len = 0;
- wait_type = max_wait_time == 0 ? F_SETLK : F_SETLKW;
+ if (max_wait_time == 0)
+ wait_type = F_SETLK;
+ else {
+ wait_type = F_SETLKW;
+ alarm(I_MIN(max_wait_time, 5));
+ }
+
while (fcntl(ctx->ibox->mbox_fd, wait_type, &fl) < 0) {
if (errno != EINTR) {
if (errno != EAGAIN && errno != EACCES)
mbox_set_syscall_error(ctx->ibox, "fcntl()");
+ alarm(0);
return -1;
}
now = time(NULL);
- if (max_wait_time != 0 && now >= max_wait_time)
+ if (max_wait_time != 0 && now >= max_wait_time) {
+ alarm(0);
return 0;
+ }
+
+ /* notify locks once every 5 seconds.
+ try to use rounded values. */
+ next_alarm = (max_wait_time - now) % 5;
+ if (next_alarm == 0)
+ next_alarm = 5;
+ alarm(next_alarm);
index_storage_lock_notify(ctx->ibox,
MAILBOX_LOCK_NOTIFY_MAILBOX_ABORT,
max_wait_time - now);
}
+ alarm(0);
return 1;
}
Index: mbox-save.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- mbox-save.c 8 Jul 2004 20:26:16 -0000 1.56
+++ mbox-save.c 15 Aug 2004 03:40:32 -0000 1.57
@@ -292,8 +292,7 @@
return -1;
ctx->output = o_stream_create_file(ibox->mbox_fd, default_pool,
- 4096, FALSE);
- o_stream_set_blocking(ctx->output, 60000, NULL, NULL);
+ 0, FALSE);
}
if (!ctx->synced && mail_r != NULL) {
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c,
1.36, 1.37
- Next message: [dovecot-cvs] dovecot/src/lib Makefile.am, 1.39, 1.40 alarm-hup.c,
1.6, NONE alarm-hup.h, 1.1, NONE file-lock.c, 1.8,
1.9 iostream-internal.h, 1.4, 1.5 iostream.c, 1.5,
1.6 istream-data.c, 1.8, 1.9 istream-file.c, 1.17,
1.18 istream-limit.c, 1.6, 1.7 istream-mmap.c, 1.11,
1.12 istream.c, 1.19, 1.20 istream.h, 1.10, 1.11 lib.c, 1.10,
1.11 ostream-file.c, 1.27, 1.28 ostream-internal.h, 1.2,
1.3 ostream.c, 1.8, 1.9 ostream.h, 1.8, 1.9 strfuncs.c, 1.41,
1.42 strfuncs.h, 1.20, 1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list