Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
8e262d87
...
8e262d87a226fbdf46af300836d4add807021de6
authored
2001-08-05 13:45:59 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed some comments.
1 parent
71da3446
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
mailbox/stream.c
mailbox/stream.c
View file @
8e262d8
...
...
@@ -38,13 +38,13 @@
static
int
refill
(
stream_t
,
off_t
);
/*
Stream is a way for object to do I/O, they can take over(overload) the
the read/write functions for there needs. We are doing some very
minimal buffering on the read when the stream_bufsiz is set, this
unfortunately does not take to account the offset i.e if the offset ask
is
different then the offset we maintain internally, the buffer is flushed
and a new buffer is use, this buffering is more
for networking stream (POP/IMAP). No buffering on the write
. */
/*
A stream provides a way for an object to do I/O. It overloads
stream read/write functions. Only a minimal buffering is done
and that if stream's bufsiz member is set. If the requested
offset does not equal the one maintained internally the buffer
is
flushed and refilled. This buffering scheme is more convenient
for networking streams (POP/IMAP).
Writes are always unbuffered
. */
int
stream_create
(
stream_t
*
pstream
,
int
flags
,
void
*
owner
)
{
...
...
@@ -56,8 +56,8 @@ stream_create (stream_t *pstream, int flags, void *owner)
return
ENOMEM
;
stream
->
owner
=
owner
;
stream
->
flags
=
flags
;
/* By default unbuffered, the buffer
ed
scheme is not for all models, it
really makes sense for network
ing
streams, where there is no offset. */
/* By default unbuffered, the buffer
ing
scheme is not for all models, it
really makes sense for network streams, where there is no offset. */
/* stream->rbuffer.bufsiz = BUFSIZ; */
*
pstream
=
stream
;
return
0
;
...
...
@@ -133,13 +133,12 @@ stream_setbufsiz (stream_t stream, size_t size)
}
/* We have to be clear about the buffering scheme, it is not designed to be
use as a fully fledge buffer mechanism. It is a simple mechanims for
networking. Lots of code between POP and IMAP can be share this way.
- First caveat; the offset as no meaning i.e. the code does move back or
up the buffer, if the offset is different then the maintain interanl offset
the buffer is flush out and new read from the asking offset is done. It
is up to the concrete _read() to return EISPIPE when error.
used as a full-fledged buffer mechanism. It is a simple mechanism for
networking. Lots of code between POP and IMAP can be shared this way.
- First caveat; the code maintains its own offset (rbuffer.offset member)
and if it does not match the requested one, the data is flushed
and the underlying _read is called. It is up to the latter to return
EISPIPE when appropriate.
- Again, this is targeting networking stream to make readline()
a little bit more efficient, instead of reading a char at a time. */
...
...
@@ -170,7 +169,7 @@ stream_read (stream_t is, char *buf, size_t count,
size_t
residue
=
count
;
int
r
;
/* If the amount requested is bigger th
en the buffer cache size
/* If the amount requested is bigger th
an the buffer cache size,
bypass it. Do no waste time and let it through. */
if
(
count
>
is
->
rbuffer
.
bufsiz
)
{
...
...
Please
register
or
sign in
to post a comment