| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 QuicDispatcher::~QuicDispatcher() { | 51 QuicDispatcher::~QuicDispatcher() { |
| 52 STLDeleteValues(&session_map_); | 52 STLDeleteValues(&session_map_); |
| 53 STLDeleteElements(&closed_session_list_); | 53 STLDeleteElements(&closed_session_list_); |
| 54 } | 54 } |
| 55 | 55 |
| 56 int QuicDispatcher::WritePacket(const char* buffer, size_t buf_len, | 56 int QuicDispatcher::WritePacket(const char* buffer, size_t buf_len, |
| 57 const IPAddressNumber& self_address, | 57 const IPAddressNumber& self_address, |
| 58 const IPEndPoint& peer_address, | 58 const IPEndPoint& peer_address, |
| 59 QuicBlockedWriterInterface* writer, | 59 QuicBlockedWriterInterface* writer, |
| 60 int* error) { | 60 int* error) { |
| 61 if (write_blocked_) { |
| 62 write_blocked_list_.AddBlockedObject(writer); |
| 63 *error = EAGAIN; |
| 64 return -1; |
| 65 } |
| 66 |
| 61 int rc = QuicSocketUtils::WritePacket(fd_, buffer, buf_len, | 67 int rc = QuicSocketUtils::WritePacket(fd_, buffer, buf_len, |
| 62 self_address, peer_address, | 68 self_address, peer_address, |
| 63 error); | 69 error); |
| 64 if (rc == -1 && (*error == EWOULDBLOCK || *error == EAGAIN)) { | 70 if (rc == -1 && (*error == EWOULDBLOCK || *error == EAGAIN)) { |
| 65 write_blocked_list_.AddBlockedObject(writer); | 71 write_blocked_list_.AddBlockedObject(writer); |
| 66 write_blocked_ = true; | 72 write_blocked_ = true; |
| 67 } | 73 } |
| 68 return rc; | 74 return rc; |
| 69 } | 75 } |
| 70 | 76 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 QuicServerSession* session = new QuicServerSession( | 190 QuicServerSession* session = new QuicServerSession( |
| 185 config_, new QuicConnection(guid, client_address, helper, true), this); | 191 config_, new QuicConnection(guid, client_address, helper, true), this); |
| 186 session->Initialize(crypto_config_); | 192 session->Initialize(crypto_config_); |
| 187 return session; | 193 return session; |
| 188 } | 194 } |
| 189 | 195 |
| 190 } // namespace tools | 196 } // namespace tools |
| 191 } // namespace net | 197 } // namespace net |
| 192 | 198 |
| 193 | 199 |
| OLD | NEW |