forked from rsocket/rsocket-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScheduledFrameTransport.cpp
More file actions
33 lines (26 loc) · 974 Bytes
/
ScheduledFrameTransport.cpp
File metadata and controls
33 lines (26 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "rsocket/framing/ScheduledFrameTransport.h"
#include <folly/io/IOBuf.h>
namespace rsocket {
ScheduledFrameTransport::~ScheduledFrameTransport() {}
void ScheduledFrameTransport::setFrameProcessor(
std::shared_ptr<FrameProcessor> fp) {
transportEvb_->runInEventBaseThread(
[ this, self = this->ref_from_this(this), fp = std::move(fp) ]() mutable {
auto scheduledFP = std::make_shared<ScheduledFrameProcessor>(
std::move(fp), stateMachineEvb_);
frameTransport_->setFrameProcessor(std::move(scheduledFP));
});
}
void ScheduledFrameTransport::outputFrameOrDrop(
std::unique_ptr<folly::IOBuf> ioBuf) {
transportEvb_->runInEventBaseThread(
[ ft = frameTransport_, ioBuf = std::move(ioBuf) ]() mutable {
ft->outputFrameOrDrop(std::move(ioBuf));
});
}
void ScheduledFrameTransport::close() {
transportEvb_->runInEventBaseThread([ft = frameTransport_]() {
ft->close();
});
}
} // rsocket