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

Side by Side Diff: chrome/test/chromedriver/net/websocket.cc

Issue 1565303002: Change IPEndpoint::address() to return a net::IPAddress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase for ChromeOS Created 4 years, 10 months 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
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 "chrome/test/chromedriver/net/websocket.h" 5 #include "chrome/test/chromedriver/net/websocket.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <vector> 10 #include <vector>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (getaddrinfo(host.c_str(), NULL, &hints, &result)) 44 if (getaddrinfo(host.c_str(), NULL, &hints, &result))
45 return false; 45 return false;
46 46
47 for (struct addrinfo* addr = result; addr; addr = addr->ai_next) { 47 for (struct addrinfo* addr = result; addr; addr = addr->ai_next) {
48 if (addr->ai_family == AF_INET || addr->ai_family == AF_INET6) { 48 if (addr->ai_family == AF_INET || addr->ai_family == AF_INET6) {
49 net::IPEndPoint end_point; 49 net::IPEndPoint end_point;
50 if (!end_point.FromSockAddr(addr->ai_addr, addr->ai_addrlen)) { 50 if (!end_point.FromSockAddr(addr->ai_addr, addr->ai_addrlen)) {
51 freeaddrinfo(result); 51 freeaddrinfo(result);
52 return false; 52 return false;
53 } 53 }
54 *address = end_point.address(); 54 *address = end_point.address().bytes();
55 } 55 }
56 } 56 }
57 freeaddrinfo(result); 57 freeaddrinfo(result);
58 return true; 58 return true;
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
63 WebSocket::WebSocket(const GURL& url, WebSocketListener* listener) 63 WebSocket::WebSocket(const GURL& url, WebSocketListener* listener)
64 : url_(url), 64 : url_(url),
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 void WebSocket::Close(int code) { 259 void WebSocket::Close(int code) {
260 socket_->Disconnect(); 260 socket_->Disconnect();
261 if (!connect_callback_.is_null()) 261 if (!connect_callback_.is_null())
262 InvokeConnectCallback(code); 262 InvokeConnectCallback(code);
263 if (state_ == OPEN) 263 if (state_ == OPEN)
264 listener_->OnClose(); 264 listener_->OnClose();
265 265
266 state_ = CLOSED; 266 state_ = CLOSED;
267 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698