#undef LOCAL_DEBUG
-#include "ucw/lib.h"
-#include "ucw/mainloop.h"
+#include <ucw/lib.h>
+#include <ucw/mainloop.h>
#include <stdio.h>
#include <string.h>
struct main_block_io *bio = tm->data;
timer_del(&bio->timer);
if (bio->error_handler)
- bio->error_handler(bio, MFERR_TIMEOUT);
+ bio->error_handler(bio, BIO_ERR_TIMEOUT);
}
void
if (l < 0)
{
if (errno != EINTR && errno != EAGAIN && bio->error_handler)
- bio->error_handler(bio, MFERR_READ);
- return 0;
+ bio->error_handler(bio, BIO_ERR_READ);
+ return HOOK_IDLE;
}
else if (!l)
break;
fi->read_handler = NULL;
file_chg(fi);
bio->read_done(bio);
- return 1;
+ return HOOK_RETRY;
}
static int
if (l < 0)
{
if (errno != EINTR && errno != EAGAIN && bio->error_handler)
- bio->error_handler(bio, MFERR_WRITE);
- return 0;
+ bio->error_handler(bio, BIO_ERR_WRITE);
+ return HOOK_IDLE;
}
bio->wpos += l;
}
fi->write_handler = NULL;
file_chg(fi);
bio->write_done(bio);
- return 1;
+ return HOOK_RETRY;
}
void
}
file_chg(&bio->file);
}
+
+void
+block_io_set_timeout(struct main_block_io *bio, timestamp_t expires_delta)
+{
+ if (!expires_delta)
+ timer_del(&bio->timer);
+ else
+ timer_add_rel(&bio->timer, expires_delta);
+}