#include <sys/socket.h>
#include "net/base/ip_endpoint.h"
+#include "net/quic/congestion_control/tcp_receiver.h"
#include "net/quic/crypto/crypto_handshake.h"
#include "net/quic/crypto/quic_random.h"
#include "net/quic/quic_clock.h"
const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
static const char kSourceAddressTokenSecret[] = "secret";
+const uint32 kServerInitialFlowControlWindow = 100 * net::kMaxPacketSize;
namespace net {
namespace tools {
overflow_supported_(false),
use_recvmmsg_(false),
crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()),
- supported_versions_(QuicSupportedVersions()) {
+ supported_versions_(QuicSupportedVersions()),
+ server_initial_flow_control_receive_window_(
+ kServerInitialFlowControlWindow) {
// Use hardcoded crypto parameters for now.
config_.SetDefaults();
- config_.set_initial_round_trip_time_us(kMaxInitialRoundTripTimeUs, 0);
- config_.set_server_initial_congestion_window(kMaxInitialWindow,
- kDefaultInitialWindow);
Initialize();
}
QuicServer::QuicServer(const QuicConfig& config,
- const QuicVersionVector& supported_versions)
+ const QuicVersionVector& supported_versions,
+ uint32 server_initial_flow_control_receive_window)
: port_(0),
fd_(-1),
packets_dropped_(0),
use_recvmmsg_(false),
config_(config),
crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()),
- supported_versions_(supported_versions) {
+ supported_versions_(supported_versions),
+ server_initial_flow_control_receive_window_(
+ server_initial_flow_control_receive_window) {
Initialize();
}
overflow_supported_ = true;
}
+ // These send and receive buffer sizes are sized for a single connection,
+ // because the default usage of QuicServer is as a test server with one or
+ // two clients. Adjust higher for use with many clients.
+ if (!QuicSocketUtils::SetReceiveBufferSize(fd_,
+ TcpReceiver::kReceiveWindowTCP)) {
+ return false;
+ }
+
+ if (!QuicSocketUtils::SetSendBufferSize(fd_,
+ TcpReceiver::kReceiveWindowTCP)) {
+ return false;
+ }
+
// Enable the socket option that allows the local address to be
// returned if the socket is bound to more than on address.
int get_local_ip = 1;
epoll_server_.RegisterFD(fd_, this, kEpollFlags);
dispatcher_.reset(new QuicDispatcher(
- config_, crypto_config_, supported_versions_, &epoll_server_));
+ config_,
+ crypto_config_,
+ supported_versions_,
+ &epoll_server_,
+ server_initial_flow_control_receive_window_));
dispatcher_->Initialize(fd_);
return true;