virtual void attachPipeline() = 0;
virtual void detachPipeline() = 0;
- virtual void attachTransport() = 0;
- virtual void detachTransport() = 0;
-
template <class H, class HandlerContext>
void attachContext(H* handler, HandlerContext* ctx) {
if (++handler->attachCount_ == 1) {
virtual void read(In msg) = 0;
virtual void readEOF() = 0;
virtual void readException(exception_wrapper e) = 0;
+ virtual void transportActive() = 0;
+ virtual void transportInactive() = 0;
};
template <class Out>
attached_ = false;
}
- void attachTransport() override {
- DestructorGuard dg(pipeline_);
- handler_->attachTransport(impl_);
- }
-
- void detachTransport() override {
- DestructorGuard dg(pipeline_);
- handler_->detachTransport(impl_);
- }
-
void setNextIn(PipelineContext* ctx) override {
auto nextIn = dynamic_cast<InboundLink<typename H::rout>*>(ctx);
if (nextIn) {
}
}
+ void fireTransportActive() override {
+ DestructorGuard dg(this->pipeline_);
+ if (this->nextIn_) {
+ this->nextIn_->transportActive();
+ }
+ }
+
+ void fireTransportInactive() override {
+ DestructorGuard dg(this->pipeline_);
+ if (this->nextIn_) {
+ this->nextIn_->transportInactive();
+ }
+ }
+
Future<void> fireWrite(Wout msg) override {
DestructorGuard dg(this->pipeline_);
if (this->nextOut_) {
return this->pipeline_;
}
- std::shared_ptr<AsyncTransport> getTransport() override {
- return this->pipeline_->getTransport();
- }
-
void setWriteFlags(WriteFlags flags) override {
this->pipeline_->setWriteFlags(flags);
}
this->handler_->readException(this, std::move(e));
}
+ void transportActive() override {
+ DestructorGuard dg(this->pipeline_);
+ this->handler_->transportActive(this);
+ }
+
+ void transportInactive() override {
+ DestructorGuard dg(this->pipeline_);
+ this->handler_->transportInactive(this);
+ }
+
// OutboundLink overrides
Future<void> write(Win msg) override {
DestructorGuard dg(this->pipeline_);
}
}
- PipelineBase* getPipeline() override {
- return this->pipeline_;
+ void fireTransportActive() override {
+ DestructorGuard dg(this->pipeline_);
+ if (this->nextIn_) {
+ this->nextIn_->transportActive();
+ }
}
- std::shared_ptr<AsyncTransport> getTransport() override {
- return this->pipeline_->getTransport();
+ void fireTransportInactive() override {
+ DestructorGuard dg(this->pipeline_);
+ if (this->nextIn_) {
+ this->nextIn_->transportInactive();
+ }
+ }
+
+ PipelineBase* getPipeline() override {
+ return this->pipeline_;
}
// InboundLink overrides
this->handler_->readException(this, std::move(e));
}
+ void transportActive() override {
+ DestructorGuard dg(this->pipeline_);
+ this->handler_->transportActive(this);
+ }
+
+ void transportInactive() override {
+ DestructorGuard dg(this->pipeline_);
+ this->handler_->transportInactive(this);
+ }
+
private:
using DestructorGuard = typename P::DestructorGuard;
};
return this->pipeline_;
}
- std::shared_ptr<AsyncTransport> getTransport() override {
- return this->pipeline_->getTransport();
- }
-
// OutboundLink overrides
Future<void> write(Win msg) override {
DestructorGuard dg(this->pipeline_);