| 553 | {} |
| 554 | ~MessageBatcher() { flush(); } |
| 555 | void flush() { |
| 556 | if (_size > 0 && _s->_options.handler != NULL) { |
| 557 | _s->_options.handler->on_received_messages( |
| 558 | _s->id(), _storage, _size); |
| 559 | } |
| 560 | for (size_t i = 0; i < _size; ++i) { |
| 561 | delete _storage[i]; |
| 562 | } |
| 563 | _size = 0; |
| 564 | } |
| 565 | void push(butil::IOBuf* buf) { |
| 566 | if (_size == _cap) { |
| 567 | flush(); |
no test coverage detected