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

Side by Side Diff: runtime/bin/socket_win.cc

Issue 163903002: Prototype of I/O statistics for Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/eventhandler.h" 9 #include "bin/eventhandler.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 110
111 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { 111 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) {
112 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket()); 112 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket());
113 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); 113 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd);
114 RawAddr raw; 114 RawAddr raw;
115 socklen_t size = sizeof(raw); 115 socklen_t size = sizeof(raw);
116 if (getpeername(socket_handle->socket(), 116 if (getpeername(socket_handle->socket(),
117 &raw.addr, 117 &raw.addr,
118 &size)) { 118 &size)) {
119 Log::PrintErr("Error getpeername: %d\n", WSAGetLastError());
120 return NULL; 119 return NULL;
121 } 120 }
122 *port = SocketAddress::GetAddrPort(&raw); 121 *port = SocketAddress::GetAddrPort(&raw);
123 // Clear the port before calling WSAAddressToString as WSAAddressToString 122 // Clear the port before calling WSAAddressToString as WSAAddressToString
124 // includes the port in the formatted string. 123 // includes the port in the formatted string.
125 SocketAddress::SetAddrPort(&raw, 0); 124 SocketAddress::SetAddrPort(&raw, 0);
126 return new SocketAddress(&raw.addr); 125 return new SocketAddress(&raw.addr);
127 } 126 }
128 127
129 128
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 proto, 647 proto,
649 MCAST_LEAVE_GROUP, 648 MCAST_LEAVE_GROUP,
650 reinterpret_cast<char *>(&mreq), 649 reinterpret_cast<char *>(&mreq),
651 sizeof(mreq)) == 0; 650 sizeof(mreq)) == 0;
652 } 651 }
653 652
654 } // namespace bin 653 } // namespace bin
655 } // namespace dart 654 } // namespace dart
656 655
657 #endif // defined(TARGET_OS_WINDOWS) 656 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698