Commit 1d633806 authored by Niels Möller's avatar Niels Möller
Browse files

(make_write_buffer): Added fd argument.

(do_write): Call lsh_oop_register_write_fd when buffer gets
non-empty.

Rev: src/write_buffer.c:1.23
Rev: src/write_buffer.h:1.21
parent 80a4adfa
......@@ -61,14 +61,12 @@ do_write(struct abstract_write *w,
string_queue_add_tail(&closure->q, packet);
#if 0
if (closure->try_write)
{
/* Attempt writing to the corresponding fd. */
}
#endif
if (!closure->length)
/* We're making the buffer non-empty */
lsh_oop_register_write_fd(closure->fd);
closure->empty = 0;
closure->length += packet->length;
debug("write_buffer: do_write closure->length = %i\n",
......@@ -161,11 +159,13 @@ void write_buffer_close(struct write_buffer *buffer)
}
struct write_buffer *
make_write_buffer(UINT32 size)
make_write_buffer(struct lsh_fd *fd, UINT32 size)
{
NEW(write_buffer, res);
res->super.write = do_write;
res->fd = fd;
res->block_size = size;
......
......@@ -49,6 +49,8 @@
(name write_buffer)
(super abstract_write)
(vars
(fd object lsh_fd)
(block_size . UINT32)
(buffer space UINT8) ; Size is twice the blocksize
(empty . int)
......@@ -62,8 +64,6 @@
; should be closed once the current buffers are flushed.
(closed . int)
;; (try_write . int)
(q struct string_queue)
(pos . UINT32) ; Partial packet
......@@ -73,7 +73,9 @@
(end . UINT32)))
*/
struct write_buffer *make_write_buffer(UINT32 size);
struct write_buffer *
make_write_buffer(struct lsh_fd *fd, UINT32 size);
int write_buffer_pre_write(struct write_buffer *buffer);
void write_buffer_consume(struct write_buffer *buffer, UINT32 size);
void write_buffer_close(struct write_buffer *buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment