| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 | 5 |
| 6 #include "nacl_io/mount_node_udp.h" | 6 #include "nacl_io/mount_node_udp.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Now that we are bound, we can start sending and receiving. | 218 // Now that we are bound, we can start sending and receiving. |
| 219 SetStreamFlags(SSF_CAN_SEND | SSF_CAN_RECV); | 219 SetStreamFlags(SSF_CAN_SEND | SSF_CAN_RECV); |
| 220 QueueInput(); | 220 QueueInput(); |
| 221 | 221 |
| 222 local_addr_ = out_addr; | 222 local_addr_ = out_addr; |
| 223 return 0; | 223 return 0; |
| 224 } | 224 } |
| 225 | 225 |
| 226 Error MountNodeUDP::Connect(const struct sockaddr* addr, socklen_t len) { | 226 Error MountNodeUDP::Connect(const HandleAttr& attr, |
| 227 const struct sockaddr* addr, |
| 228 socklen_t len) { |
| 227 if (0 == socket_resource_) | 229 if (0 == socket_resource_) |
| 228 return EBADF; | 230 return EBADF; |
| 229 | 231 |
| 230 /* Connect for UDP is the default dest, it's legal to change it. */ | 232 /* Connect for UDP is the default dest, it's legal to change it. */ |
| 231 if (remote_addr_ != 0) { | 233 if (remote_addr_ != 0) { |
| 232 mount_->ppapi()->ReleaseResource(remote_addr_); | 234 mount_->ppapi()->ReleaseResource(remote_addr_); |
| 233 remote_addr_ = 0; | 235 remote_addr_ = 0; |
| 234 } | 236 } |
| 235 | 237 |
| 236 remote_addr_ = SockAddrToResource(addr, len); | 238 remote_addr_ = SockAddrToResource(addr, len); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 Packet* packet = new Packet(mount_->ppapi()); | 280 Packet* packet = new Packet(mount_->ppapi()); |
| 279 packet->Copy(buf, capped_len, addr); | 281 packet->Copy(buf, capped_len, addr); |
| 280 | 282 |
| 281 emitter_->WriteTXPacket_Locked(packet); | 283 emitter_->WriteTXPacket_Locked(packet); |
| 282 *out_len = capped_len; | 284 *out_len = capped_len; |
| 283 return 0; | 285 return 0; |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace nacl_io | 288 } // namespace nacl_io |
| 287 | 289 |
| OLD | NEW |