OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return SS_OPENING; | 53 return SS_OPENING; |
54 case Socket::CS_CLOSED: | 54 case Socket::CS_CLOSED: |
55 default: | 55 default: |
56 return SS_CLOSED; | 56 return SS_CLOSED; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 StreamResult SocketStream::Read(void* buffer, size_t buffer_len, | 60 StreamResult SocketStream::Read(void* buffer, size_t buffer_len, |
61 size_t* read, int* error) { | 61 size_t* read, int* error) { |
62 ASSERT(socket_ != NULL); | 62 ASSERT(socket_ != NULL); |
63 int result = socket_->Recv(buffer, buffer_len); | 63 int result = socket_->Recv(buffer, buffer_len, nullptr); |
64 if (result < 0) { | 64 if (result < 0) { |
65 if (socket_->IsBlocking()) | 65 if (socket_->IsBlocking()) |
66 return SR_BLOCK; | 66 return SR_BLOCK; |
67 if (error) | 67 if (error) |
68 *error = socket_->GetError(); | 68 *error = socket_->GetError(); |
69 return SR_ERROR; | 69 return SR_ERROR; |
70 } | 70 } |
71 if ((result > 0) || (buffer_len == 0)) { | 71 if ((result > 0) || (buffer_len == 0)) { |
72 if (read) | 72 if (read) |
73 *read = result; | 73 *read = result; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SignalEvent(this, SE_WRITE, 0); | 112 SignalEvent(this, SE_WRITE, 0); |
113 } | 113 } |
114 | 114 |
115 void SocketStream::OnCloseEvent(AsyncSocket* socket, int err) { | 115 void SocketStream::OnCloseEvent(AsyncSocket* socket, int err) { |
116 ASSERT(socket == socket_); | 116 ASSERT(socket == socket_); |
117 SignalEvent(this, SE_CLOSE, err); | 117 SignalEvent(this, SE_CLOSE, err); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 } // namespace rtc | 121 } // namespace rtc |
OLD | NEW |