Line data Source code
1 : #include "http_stream.hpp"
2 :
3 : namespace thinger::http {
4 :
5 0 : size_t http_stream::get_queue_size() const {
6 0 : return queue_.size();
7 : }
8 :
9 1059 : bool http_stream::empty_queue() const {
10 1059 : return queue_.empty();
11 : }
12 :
13 1023 : std::shared_ptr<http_frame> http_stream::current_frame() const {
14 1023 : return queue_.front();
15 : }
16 :
17 1023 : void http_stream::pop_frame() {
18 1023 : queue_.pop();
19 1023 : }
20 :
21 1023 : void http_stream::add_frame(std::shared_ptr<http_frame> frame) {
22 1023 : queue_.push(frame);
23 1023 : }
24 :
25 0 : size_t http_stream::get_queued_frames() const {
26 0 : return queue_.size();
27 : }
28 :
29 59 : void http_stream::on_completed(std::function<void()> callback) {
30 59 : stream_callback_ = callback;
31 59 : }
32 :
33 1005 : void http_stream::completed() {
34 1005 : if (stream_callback_) {
35 59 : stream_callback_();
36 59 : stream_callback_ = nullptr;
37 : }
38 1005 : }
39 :
40 2046 : stream_id http_stream::id() const {
41 2046 : return stream_id_;
42 : }
43 : }
|