Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: net/udp/udp_socket_libevent.cc

Issue 11528012: [net] Make IPEndPoint::GetFamily() return AddressFamily and add GetSockAddrFamily() to be used when… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update uses of GetFamily in net/dns/ Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/transport_client_socket_pool_unittest.cc ('k') | net/udp/udp_socket_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_libevent.h" 5 #include "net/udp/udp_socket_libevent.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <netdb.h> 9 #include <netdb.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 CreateNetLogUDPDataTranferCallback( 354 CreateNetLogUDPDataTranferCallback(
355 result, bytes, 355 result, bytes,
356 is_address_valid ? &address : NULL)); 356 is_address_valid ? &address : NULL));
357 } 357 }
358 358
359 base::StatsCounter read_bytes("udp.read_bytes"); 359 base::StatsCounter read_bytes("udp.read_bytes");
360 read_bytes.Add(result); 360 read_bytes.Add(result);
361 } 361 }
362 362
363 int UDPSocketLibevent::CreateSocket(const IPEndPoint& address) { 363 int UDPSocketLibevent::CreateSocket(const IPEndPoint& address) {
364 socket_ = socket(address.GetFamily(), SOCK_DGRAM, 0); 364 socket_ = socket(address.GetSockAddrFamily(), SOCK_DGRAM, 0);
365 if (socket_ == kInvalidSocket) 365 if (socket_ == kInvalidSocket)
366 return MapSystemError(errno); 366 return MapSystemError(errno);
367 if (SetNonBlocking(socket_)) { 367 if (SetNonBlocking(socket_)) {
368 const int err = MapSystemError(errno); 368 const int err = MapSystemError(errno);
369 Close(); 369 Close();
370 return err; 370 return err;
371 } 371 }
372 return OK; 372 return OK;
373 } 373 }
374 374
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 501
502 for (int i = 0; i < kBindRetries; ++i) { 502 for (int i = 0; i < kBindRetries; ++i) {
503 int rv = DoBind(IPEndPoint(ip, rand_int_cb_.Run(kPortStart, kPortEnd))); 503 int rv = DoBind(IPEndPoint(ip, rand_int_cb_.Run(kPortStart, kPortEnd)));
504 if (rv == OK || rv != ERR_ADDRESS_IN_USE) 504 if (rv == OK || rv != ERR_ADDRESS_IN_USE)
505 return rv; 505 return rv;
506 } 506 }
507 return DoBind(IPEndPoint(ip, 0)); 507 return DoBind(IPEndPoint(ip, 0));
508 } 508 }
509 509
510 } // namespace net 510 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool_unittest.cc ('k') | net/udp/udp_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698