OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/udp/udp_socket_win.h" | 5 #include "net/udp/udp_socket_win.h" |
6 | 6 |
7 #include <mstcpip.h> | 7 #include <mstcpip.h> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (rv < 0) | 342 if (rv < 0) |
343 return rv; | 343 return rv; |
344 rv = DoBind(address); | 344 rv = DoBind(address); |
345 if (rv < 0) | 345 if (rv < 0) |
346 return rv; | 346 return rv; |
347 local_address_.reset(); | 347 local_address_.reset(); |
348 return rv; | 348 return rv; |
349 } | 349 } |
350 | 350 |
351 int UDPSocketWin::CreateSocket(const IPEndPoint& address) { | 351 int UDPSocketWin::CreateSocket(const IPEndPoint& address) { |
352 socket_ = WSASocket(address.GetFamily(), SOCK_DGRAM, IPPROTO_UDP, NULL, 0, | 352 socket_ = WSASocket(address.GetSockAddrFamily(), SOCK_DGRAM, IPPROTO_UDP, |
353 WSA_FLAG_OVERLAPPED); | 353 NULL, 0, WSA_FLAG_OVERLAPPED); |
354 if (socket_ == INVALID_SOCKET) | 354 if (socket_ == INVALID_SOCKET) |
355 return MapSystemError(WSAGetLastError()); | 355 return MapSystemError(WSAGetLastError()); |
356 core_ = new Core(this); | 356 core_ = new Core(this); |
357 return OK; | 357 return OK; |
358 } | 358 } |
359 | 359 |
360 bool UDPSocketWin::SetReceiveBufferSize(int32 size) { | 360 bool UDPSocketWin::SetReceiveBufferSize(int32 size) { |
361 DCHECK(CalledOnValidThread()); | 361 DCHECK(CalledOnValidThread()); |
362 int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF, | 362 int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF, |
363 reinterpret_cast<const char*>(&size), sizeof(size)); | 363 reinterpret_cast<const char*>(&size), sizeof(size)); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 } | 602 } |
603 return DoBind(IPEndPoint(ip, 0)); | 603 return DoBind(IPEndPoint(ip, 0)); |
604 } | 604 } |
605 | 605 |
606 bool UDPSocketWin::ReceiveAddressToIPEndpoint(IPEndPoint* address) const { | 606 bool UDPSocketWin::ReceiveAddressToIPEndpoint(IPEndPoint* address) const { |
607 SockaddrStorage& storage = core_->recv_addr_storage_; | 607 SockaddrStorage& storage = core_->recv_addr_storage_; |
608 return address->FromSockAddr(storage.addr, storage.addr_len); | 608 return address->FromSockAddr(storage.addr, storage.addr_len); |
609 } | 609 } |
610 | 610 |
611 } // namespace net | 611 } // namespace net |
OLD | NEW |