blob: 0ccd2c1d5e8d6281c6ed23f20061ad5b38927b67 [file] [log] [blame]
Bence Békybac04052022-04-07 15:44:29 -04001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "quiche/quic/core/quic_epoll_connection_helper.h"
6
7#include <errno.h>
8#include <sys/socket.h>
9
10#include "quiche/quic/core/crypto/quic_random.h"
11
12namespace quic {
13
14QuicEpollConnectionHelper::QuicEpollConnectionHelper(
15 QuicEpollServer* epoll_server, QuicAllocator allocator_type)
16 : clock_(epoll_server),
17 random_generator_(QuicRandom::GetInstance()),
18 allocator_type_(allocator_type) {}
19
20QuicEpollConnectionHelper::~QuicEpollConnectionHelper() = default;
21
22const QuicClock* QuicEpollConnectionHelper::GetClock() const {
23 return &clock_;
24}
25
26QuicRandom* QuicEpollConnectionHelper::GetRandomGenerator() {
27 return random_generator_;
28}
29
30quiche::QuicheBufferAllocator*
31QuicEpollConnectionHelper::GetStreamSendBufferAllocator() {
32 if (allocator_type_ == QuicAllocator::BUFFER_POOL) {
33 return &stream_buffer_allocator_;
34 } else {
35 QUICHE_DCHECK(allocator_type_ == QuicAllocator::SIMPLE);
36 return &simple_buffer_allocator_;
37 }
38}
39
40} // namespace quic