-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Allow filters to write through downstream filters only #3343
Description
Title: Allow filters to write through downstream filters only
Description:
A Network::Filter that does protocol translation can intercept and replace data going up or down stream in onData and onWrite. However sometimes onData may need to write downstream, e.g. to respond to a downstream event that is not reflected in the upstream protocol. Also the filter may need to write timer-based downstream heartbeats that are independent of the upstream protocol.
The existing Connection::write() function goes through the entire write filter chain , starting at the top and including the current filter. This is not what we want - we only want the write to be seen by filters downstream of the current one.
On Sat, May 5, 2018 at 12:19 PM, Matt Klein [email protected] wrote:
The correct solution here is to add functionality to the network filter callbacks to perform writes. You can model this after how HTTP filters work when encoding headers, data, etc.
I.e., in https://github.com/envoyproxy/envoy/blob/master/include/envoy/network/filter.h you will need to add write() to ReadFilterCallbacks, and you might need to add WriteFilterCallbacks, with a write function. Optimally, the Connection accessor would be made constant, so any modifiers to the connection need to operate through the callbacks which can handle filter iteration. This will be a bit of work, but not too terrible.
Relevant Links: motivated by https://github.com/alanconway/envoy-amqp/