OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "nacl_io/ossocket.h" | 5 #include "nacl_io/ossocket.h" |
6 #ifdef PROVIDES_SOCKET_API | 6 #ifdef PROVIDES_SOCKET_API |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 socket_resource_ = | 300 socket_resource_ = |
301 TCPInterface()->Create(filesystem_->ppapi()->GetInstance()); | 301 TCPInterface()->Create(filesystem_->ppapi()->GetInstance()); |
302 if (0 == socket_resource_) | 302 if (0 == socket_resource_) |
303 return EACCES; | 303 return EACCES; |
304 SetStreamFlags(SSF_CAN_CONNECT); | 304 SetStreamFlags(SSF_CAN_CONNECT); |
305 } | 305 } |
306 | 306 |
307 return 0; | 307 return 0; |
308 } | 308 } |
309 | 309 |
310 EventEmitter* TcpNode::GetEventEmitter() { return emitter_.get(); } | 310 EventEmitter* TcpNode::GetEventEmitter() { |
| 311 return emitter_.get(); |
| 312 } |
311 | 313 |
312 void TcpNode::SetError_Locked(int pp_error_num) { | 314 void TcpNode::SetError_Locked(int pp_error_num) { |
313 SocketNode::SetError_Locked(pp_error_num); | 315 SocketNode::SetError_Locked(pp_error_num); |
314 emitter_->SetError_Locked(); | 316 emitter_->SetError_Locked(); |
315 } | 317 } |
316 | 318 |
317 Error TcpNode::GetSockOpt(int lvl, int optname, void* optval, socklen_t* len) { | 319 Error TcpNode::GetSockOpt(int lvl, int optname, void* optval, socklen_t* len) { |
318 if (lvl == IPPROTO_TCP && optname == TCP_NODELAY) { | 320 if (lvl == IPPROTO_TCP && optname == TCP_NODELAY) { |
319 AUTO_LOCK(node_lock_); | 321 AUTO_LOCK(node_lock_); |
320 int value = tcp_nodelay_; | 322 int value = tcp_nodelay_; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 assert(emitter_.get()); | 550 assert(emitter_.get()); |
549 if (emitter_->GetError_Locked()) | 551 if (emitter_->GetError_Locked()) |
550 return EPIPE; | 552 return EPIPE; |
551 *out_len = emitter_->WriteOut_Locked((char*)buf, len); | 553 *out_len = emitter_->WriteOut_Locked((char*)buf, len); |
552 return 0; | 554 return 0; |
553 } | 555 } |
554 | 556 |
555 } // namespace nacl_io | 557 } // namespace nacl_io |
556 | 558 |
557 #endif // PROVIDES_SOCKET_API | 559 #endif // PROVIDES_SOCKET_API |
OLD | NEW |