| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/base/asynctcpsocket.h" | 11 #include "webrtc/base/asynctcpsocket.h" |
| 12 | 12 |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include "webrtc/base/byteorder.h" | 15 #include "webrtc/base/byteorder.h" |
| 16 #include "webrtc/base/common.h" | 16 #include "webrtc/base/common.h" |
| 17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 18 | 18 |
| 19 #if defined(WEBRTC_POSIX) | 19 #if defined(WEBRTC_POSIX) |
| 20 #include <errno.h> | 20 #include <errno.h> |
| 21 #endif // WEBRTC_POSIX | 21 #endif // WEBRTC_POSIX |
| 22 | 22 |
| 23 namespace rtc { | 23 namespace rtc { |
| 24 | 24 |
| 25 static const size_t kMaxPacketSize = 64 * 1024; | 25 static const size_t kMaxPacketSize = 64 * 1024; |
| 26 | 26 |
| 27 typedef uint16 PacketLength; | 27 typedef uint16_t PacketLength; |
| 28 static const size_t kPacketLenSize = sizeof(PacketLength); | 28 static const size_t kPacketLenSize = sizeof(PacketLength); |
| 29 | 29 |
| 30 static const size_t kBufSize = kMaxPacketSize + kPacketLenSize; | 30 static const size_t kBufSize = kMaxPacketSize + kPacketLenSize; |
| 31 | 31 |
| 32 static const int kListenBacklog = 5; | 32 static const int kListenBacklog = 5; |
| 33 | 33 |
| 34 // Binds and connects |socket| | 34 // Binds and connects |socket| |
| 35 AsyncSocket* AsyncTCPSocketBase::ConnectSocket( | 35 AsyncSocket* AsyncTCPSocketBase::ConnectSocket( |
| 36 rtc::AsyncSocket* socket, | 36 rtc::AsyncSocket* socket, |
| 37 const rtc::SocketAddress& bind_address, | 37 const rtc::SocketAddress& bind_address, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 memmove(data, data + kPacketLenSize + pkt_len, *len); | 291 memmove(data, data + kPacketLenSize + pkt_len, *len); |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { | 296 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { |
| 297 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); | 297 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace rtc | 300 } // namespace rtc |
| OLD | NEW |