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 |
(...skipping 19 matching lines...) Expand all Loading... | |
30 const SocketAddress& bind_address) { | 30 const SocketAddress& bind_address) { |
31 AsyncSocket* socket = | 31 AsyncSocket* socket = |
32 factory->CreateAsyncSocket(bind_address.family(), SOCK_DGRAM); | 32 factory->CreateAsyncSocket(bind_address.family(), SOCK_DGRAM); |
33 if (!socket) | 33 if (!socket) |
34 return NULL; | 34 return NULL; |
35 return Create(socket, bind_address); | 35 return Create(socket, bind_address); |
36 } | 36 } |
37 | 37 |
38 AsyncUDPSocket::AsyncUDPSocket(AsyncSocket* socket) | 38 AsyncUDPSocket::AsyncUDPSocket(AsyncSocket* socket) |
39 : socket_(socket) { | 39 : socket_(socket) { |
40 ASSERT(socket_); | 40 ASSERT(!!socket_); |
tommi
2016/03/15 09:22:09
The double not is not always not so readable, exce
kwiberg-webrtc
2016/03/15 09:59:41
OK, will remove. (!!x is the standard C idiom for
tommi (sloooow) - chröme
2016/03/15 16:49:00
This isn't the first time I'm seeing it :)
kwiberg-webrtc
2016/03/15 18:53:37
And yet you acted confused...
tommi
2016/03/17 12:23:26
I guess I was rhetorically confused :)
| |
41 size_ = BUF_SIZE; | 41 size_ = BUF_SIZE; |
42 buf_ = new char[size_]; | 42 buf_ = new char[size_]; |
43 | 43 |
44 // The socket should start out readable but not writable. | 44 // The socket should start out readable but not writable. |
45 socket_->SignalReadEvent.connect(this, &AsyncUDPSocket::OnReadEvent); | 45 socket_->SignalReadEvent.connect(this, &AsyncUDPSocket::OnReadEvent); |
46 socket_->SignalWriteEvent.connect(this, &AsyncUDPSocket::OnWriteEvent); | 46 socket_->SignalWriteEvent.connect(this, &AsyncUDPSocket::OnWriteEvent); |
47 } | 47 } |
48 | 48 |
49 AsyncUDPSocket::~AsyncUDPSocket() { | 49 AsyncUDPSocket::~AsyncUDPSocket() { |
50 delete [] buf_; | 50 delete [] buf_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // If we did not, then we should resize our buffer to be large enough. | 119 // If we did not, then we should resize our buffer to be large enough. |
120 SignalReadPacket(this, buf_, static_cast<size_t>(len), remote_addr, | 120 SignalReadPacket(this, buf_, static_cast<size_t>(len), remote_addr, |
121 CreatePacketTime(0)); | 121 CreatePacketTime(0)); |
122 } | 122 } |
123 | 123 |
124 void AsyncUDPSocket::OnWriteEvent(AsyncSocket* socket) { | 124 void AsyncUDPSocket::OnWriteEvent(AsyncSocket* socket) { |
125 SignalReadyToSend(this); | 125 SignalReadyToSend(this); |
126 } | 126 } |
127 | 127 |
128 } // namespace rtc | 128 } // namespace rtc |
OLD | NEW |