forked from boostorg/beast
1 parent
2ed1c92e03
commit
9f77867f0a
5 files changed
+105
-31
No files matched your search
@@ -107,6 +107,7 @@ class stream::read_op : public stream::read_op_base
|
||||
net::buffer_copy(
|
||||
b_, sp->b.data(), sp->read_max);
|
||||
sp->b.consume(bytes_transferred);
|
||||
sp->nread_bytes += bytes_transferred;
|
||||
}
|
||||
else if (buffer_bytes(b_) > 0)
|
||||
{
|
||||
@@ -231,6 +232,7 @@ struct stream::run_write_op
|
||||
std::lock_guard<std::mutex> lock(out->m);
|
||||
n = net::buffer_copy(out->b.prepare(n), buffers);
|
||||
out->b.commit(n);
|
||||
out->nwrite_bytes += n;
|
||||
out->notify_read();
|
||||
}
|
||||
BOOST_ASSERT(! ec);
|
||||
@@ -294,6 +296,7 @@ read_some(MutableBufferSequence const& buffers,
|
||||
auto const n = net::buffer_copy(
|
||||
buffers, in_->b.data(), in_->read_max);
|
||||
in_->b.consume(n);
|
||||
in_->nread_bytes += n;
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -377,6 +380,7 @@ write_some(
|
||||
std::lock_guard<std::mutex> lock(out->m);
|
||||
n = net::buffer_copy(out->b.prepare(n), buffers);
|
||||
out->b.commit(n);
|
||||
out->nwrite_bytes += n;
|
||||
out->notify_read();
|
||||
}
|
||||
return n;
|
||||
|
||||
@@ -141,7 +141,9 @@ class stream
|
||||
status code = status::ok;
|
||||
fail_count* fc = nullptr;
|
||||
std::size_t nread = 0;
|
||||
std::size_t nread_bytes = 0;
|
||||
std::size_t nwrite = 0;
|
||||
std::size_t nwrite_bytes = 0;
|
||||
std::size_t read_max =
|
||||
(std::numeric_limits<std::size_t>::max)();
|
||||
std::size_t write_max =
|
||||
@@ -361,6 +363,13 @@ public:
|
||||
return in_->nread;
|
||||
}
|
||||
|
||||
/// Return the number of bytes read
|
||||
std::size_t
|
||||
nread_bytes() const noexcept
|
||||
{
|
||||
return in_->nread_bytes;
|
||||
}
|
||||
|
||||
/// Return the number of writes
|
||||
std::size_t
|
||||
nwrite() const noexcept
|
||||
@@ -368,6 +377,13 @@ public:
|
||||
return in_->nwrite;
|
||||
}
|
||||
|
||||
/// Return the number of bytes written
|
||||
std::size_t
|
||||
nwrite_bytes() const noexcept
|
||||
{
|
||||
return in_->nwrite_bytes;
|
||||
}
|
||||
|
||||
/** Close the stream.
|
||||
|
||||
The other end of the connection will see
|
||||
|
||||
@@ -97,7 +97,8 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
bool wr_cont /* next write is a continuation */ = false;
|
||||
bool wr_frag /* autofrag the current message */ = false;
|
||||
bool wr_frag_opt /* autofrag option setting */ = true;
|
||||
bool wr_compress /* compress current message */ = false;
|
||||
bool wr_compress; /* compress current message */
|
||||
bool wr_compress_opt /* compress message setting */ = true;
|
||||
detail::opcode wr_opcode /* message type */ = detail::opcode::text;
|
||||
std::unique_ptr<
|
||||
std::uint8_t[]> wr_buf; // write buffer
|
||||
@@ -209,11 +210,14 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
// Called before each write frame
|
||||
// Called just before sending
|
||||
// the first frame of each message
|
||||
void
|
||||
begin_msg()
|
||||
{
|
||||
wr_frag = wr_frag_opt;
|
||||
wr_compress =
|
||||
this->pmd_enabled() && wr_compress_opt;
|
||||
|
||||
// Maintain the write buffer
|
||||
if( this->pmd_enabled() ||
|
||||
@@ -232,6 +236,8 @@ struct stream<NextLayer, deflateSupported>::impl_type
|
||||
wr_buf_size = wr_buf_opt;
|
||||
wr_buf.reset();
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user