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

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: Addressed review comments 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
« runtime/bin/socket_patch.dart ('K') | « runtime/bin/socket_patch.dart ('k') | no next file » | 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) 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());
Anders Johnsen 2014/02/19 16:14:34 Ty :)
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 proto, 635 proto,
637 MCAST_LEAVE_GROUP, 636 MCAST_LEAVE_GROUP,
638 reinterpret_cast<char *>(&mreq), 637 reinterpret_cast<char *>(&mreq),
639 sizeof(mreq)) == 0; 638 sizeof(mreq)) == 0;
640 } 639 }
641 640
642 } // namespace bin 641 } // namespace bin
643 } // namespace dart 642 } // namespace dart
644 643
645 #endif // defined(TARGET_OS_WINDOWS) 644 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« runtime/bin/socket_patch.dart ('K') | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698