51 bool tryGet(std::vector<unique_ptr<T>>& products)
59 if (stream_.
read(buf,
sizeof(buf), read))
62 timeout_ = std::chrono::seconds(1);
69 LOG_WARN(
"Failed to read from stream, reconnecting in %ld seconds...", timeout_.count());
70 std::this_thread::sleep_for(timeout_);
75 auto next = timeout_ * 2;
76 if (next <= std::chrono::seconds(120))
81 return parser_.
parse(bp, products);
virtual bool parse(BinParser &bp, std::vector< std::unique_ptr< T >> &results)=0
URProducer(URStream &stream, URParser< T > &parser)
bool tryGet(std::vector< unique_ptr< T >> &products)
std::chrono::seconds timeout_
bool read(uint8_t *buf, size_t buf_len, size_t &read)
#define LOG_WARN(format,...)