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 904 : bool http_stream::empty_queue() const {
10 904 : return queue_.empty();
11 : }
12 :
13 886 : std::shared_ptr<http_frame> http_stream::current_frame() const {
14 886 : return queue_.front();
15 : }
16 :
17 886 : void http_stream::pop_frame() {
18 886 : queue_.pop();
19 886 : }
20 :
21 886 : void http_stream::add_frame(std::shared_ptr<http_frame> frame) {
22 886 : queue_.push(frame);
23 886 : }
24 :
25 0 : size_t http_stream::get_queued_frames() const {
26 0 : return queue_.size();
27 : }
28 :
29 38 : void http_stream::on_completed(std::function<void()> callback) {
30 38 : stream_callback_ = callback;
31 38 : }
32 :
33 868 : void http_stream::completed() {
34 868 : if (stream_callback_) {
35 38 : stream_callback_();
36 38 : stream_callback_ = nullptr;
37 : }
38 868 : }
39 :
40 1772 : stream_id http_stream::id() const {
41 1772 : return stream_id_;
42 : }
43 : }
|