| Index: net/tools/quic/quic_client.cc
|
| diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc
|
| index 346010f5a503031a5b7ac76b11a52b02a005c7c1..dc4d8a4468f1f39ad76fa6e88768d309ce6a459a 100644
|
| --- a/net/tools/quic/quic_client.cc
|
| +++ b/net/tools/quic/quic_client.cc
|
| @@ -72,8 +72,8 @@ QuicClient::QuicClient(IPEndPoint server_address,
|
|
|
| QuicClient::~QuicClient() {
|
| if (connected()) {
|
| - session()->connection()->SendConnectionClosePacket(
|
| - QUIC_PEER_GOING_AWAY, "");
|
| + session()->connection()->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY,
|
| + "");
|
| }
|
| }
|
|
|
| @@ -91,8 +91,8 @@ bool QuicClient::Initialize() {
|
| }
|
|
|
| int get_overflow = 1;
|
| - int rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow,
|
| - sizeof(get_overflow));
|
| + int rc = setsockopt(
|
| + fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, sizeof(get_overflow));
|
| if (rc < 0) {
|
| DLOG(WARNING) << "Socket overflow detection not supported";
|
| } else {
|
| @@ -111,11 +111,14 @@ bool QuicClient::Initialize() {
|
|
|
| int get_local_ip = 1;
|
| if (address_family == AF_INET) {
|
| - rc = setsockopt(fd_, IPPROTO_IP, IP_PKTINFO,
|
| - &get_local_ip, sizeof(get_local_ip));
|
| + rc = setsockopt(
|
| + fd_, IPPROTO_IP, IP_PKTINFO, &get_local_ip, sizeof(get_local_ip));
|
| } else {
|
| - rc = setsockopt(fd_, IPPROTO_IPV6, IPV6_RECVPKTINFO,
|
| - &get_local_ip, sizeof(get_local_ip));
|
| + rc = setsockopt(fd_,
|
| + IPPROTO_IPV6,
|
| + IPV6_RECVPKTINFO,
|
| + &get_local_ip,
|
| + sizeof(get_local_ip));
|
| }
|
|
|
| if (rc < 0) {
|
| @@ -138,10 +141,9 @@ bool QuicClient::Initialize() {
|
| sockaddr_storage raw_addr;
|
| socklen_t raw_addr_len = sizeof(raw_addr);
|
| CHECK(client_address_.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr),
|
| - &raw_addr_len));
|
| - rc = bind(fd_,
|
| - reinterpret_cast<const sockaddr*>(&raw_addr),
|
| - sizeof(raw_addr));
|
| + &raw_addr_len));
|
| + rc =
|
| + bind(fd_, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr));
|
| if (rc < 0) {
|
| LOG(ERROR) << "Bind failed: " << strerror(errno);
|
| return false;
|
| @@ -177,19 +179,23 @@ bool QuicClient::StartConnect() {
|
| writer_.reset(writer);
|
| }
|
|
|
| - session_.reset(new QuicClientSession(
|
| - server_id_,
|
| - config_,
|
| - new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(),
|
| - writer_.get(), false, supported_versions_,
|
| - initial_flow_control_window_),
|
| - &crypto_config_));
|
| + session_.reset(
|
| + new QuicClientSession(server_id_,
|
| + config_,
|
| + new QuicConnection(GenerateConnectionId(),
|
| + server_address_,
|
| + helper_.get(),
|
| + writer_.get(),
|
| + false,
|
| + supported_versions_,
|
| + initial_flow_control_window_),
|
| + &crypto_config_));
|
| return session_->CryptoConnect();
|
| }
|
|
|
| bool QuicClient::EncryptionBeingEstablished() {
|
| return !session_->IsEncryptionEstablished() &&
|
| - session_->connection()->connected();
|
| + session_->connection()->connected();
|
| }
|
|
|
| void QuicClient::Disconnect() {
|
| @@ -214,7 +220,8 @@ void QuicClient::SendRequestsAndWaitForResponse(
|
| stream->set_visitor(this);
|
| }
|
|
|
| - while (WaitForEvents()) { }
|
| + while (WaitForEvents()) {
|
| + }
|
| }
|
|
|
| QuicSpdyClientStream* QuicClient::CreateReliableClientStream() {
|
| @@ -280,8 +287,10 @@ void QuicClient::OnClose(QuicDataStream* stream) {
|
| printf("%s\n", headers.first_line().as_string().c_str());
|
| for (BalsaHeaders::const_header_lines_iterator i =
|
| headers.header_lines_begin();
|
| - i != headers.header_lines_end(); ++i) {
|
| - printf("%s: %s\n", i->first.as_string().c_str(),
|
| + i != headers.header_lines_end();
|
| + ++i) {
|
| + printf("%s: %s\n",
|
| + i->first.as_string().c_str(),
|
| i->second.as_string().c_str());
|
| }
|
| printf("%s\n", client_stream->data().c_str());
|
| @@ -296,7 +305,7 @@ QuicPacketCreator::Options* QuicClient::options() {
|
|
|
| bool QuicClient::connected() const {
|
| return session_.get() && session_->connection() &&
|
| - session_->connection()->connected();
|
| + session_->connection()->connected();
|
| }
|
|
|
| QuicConnectionId QuicClient::GenerateConnectionId() {
|
| @@ -316,8 +325,12 @@ int QuicClient::ReadPacket(char* buffer,
|
| IPEndPoint* server_address,
|
| IPAddressNumber* client_ip) {
|
| return QuicSocketUtils::ReadPacket(
|
| - fd_, buffer, buffer_len, overflow_supported_ ? &packets_dropped_ : NULL,
|
| - client_ip, server_address);
|
| + fd_,
|
| + buffer,
|
| + buffer_len,
|
| + overflow_supported_ ? &packets_dropped_ : NULL,
|
| + client_ip,
|
| + server_address);
|
| }
|
|
|
| bool QuicClient::ReadAndProcessPacket() {
|
|
|