Exemple #1
0
int PS2Keyboard::available() {
  processBytes();
  int count = (head_ - tail_ + kBufferArraySize) % kBufferArraySize;
  if (debug_)
    debug_->recordKeyboardAvailable(count);
  return count;
}
void TlsPskAdaptor::processBytes(std::vector<Botan::byte> buffer) {
    if (buffer.size() == 0)
        return handleEof();
    auto bytesNeeded = channel->received_data(kj::mv(buffer));

    if (bytesNeeded) {
        buffer.resize(bytesNeeded);
        tasks.add(stream->read(buffer.data(), buffer.size(), buffer.size()).then(
                          [this, buffer = kj::mv(buffer)](size_t bytesRead) mutable {
            buffer.resize(bytesRead);
            processBytes(kj::mv(buffer));
        }));
    } else
        startReadLoop();
}
Exemple #3
0
 void measureMemory(bool measureProcessMemory) { peakBytes = measureProcessMemory ? processBytes() : 0; }