rsocket / rsocket-cpp

C++ implementation of RSocket
http://rsocket.io
Apache License 2.0
253 stars 99 forks source link

Don't use an output subscriber for DuplexConnection #843

Closed alexmalyshev closed 6 years ago

alexmalyshev commented 6 years ago

DuplexConnection uses a subscriber to send frames along the underlying connection. However, it makes no use of this subscriber other than onNext(). No implementation makes use of flow control, frames are always sent and always received which makes onSubscribe() do nothing. The received frame flow control is handled by the stream state machines. On top of that, terminating the output subscriber does nothing, the underlying connection is kept active so a follow up subscriber can attach and send frames. Which implies that onComplete() and onError() are also unnecessary.

Replace it with a send(std::unique_ptr<folly::IOBuf>) method. This makes things significantly simpler and keeps the same behavior that we have today.