mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 10:08:56 +02:00
ircd::server: Separate out the link's socket read function.
This commit is contained in:
parent
09d971fa9e
commit
d21c2fc37c
|
@ -30,6 +30,7 @@ struct ircd::server::link
|
|||
template<class F> size_t accumulate_tags(F&&) const;
|
||||
|
||||
void discard_read();
|
||||
const_buffer read(const mutable_buffer &buf);
|
||||
const_buffer process_read_next(const const_buffer &, tag &, bool &done);
|
||||
bool process_read(const_buffer &);
|
||||
void handle_readable_success();
|
||||
|
|
|
@ -1530,14 +1530,9 @@ try
|
|||
data(buffer) + copied, size(buffer) - copied
|
||||
};
|
||||
|
||||
const size_t received
|
||||
{
|
||||
read_one(*socket, remaining)
|
||||
};
|
||||
|
||||
const const_buffer view
|
||||
{
|
||||
data(buffer), copied + received
|
||||
read(remaining)
|
||||
};
|
||||
|
||||
const const_buffer overrun
|
||||
|
@ -1554,6 +1549,21 @@ catch(const buffer_overrun &e)
|
|||
throw;
|
||||
}
|
||||
|
||||
/// Read directly off the link's socket into buf
|
||||
ircd::const_buffer
|
||||
ircd::server::link::read(const mutable_buffer &buf)
|
||||
{
|
||||
const size_t received
|
||||
{
|
||||
read_one(*socket, buf)
|
||||
};
|
||||
|
||||
return const_buffer
|
||||
{
|
||||
data(buf), received
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
ircd::server::link::discard_read()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue