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

Side by Side Diff: runtime/bin/socket_impl.dart

Issue 10032027: Add remoteHost to Socket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed then need for allocating buffer in heap. Created 8 years, 8 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
« no previous file with comments | « runtime/bin/socket.dart ('k') | runtime/bin/socket_linux.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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 5
6 class _SocketBase { 6 class _SocketBase {
7 // Bit flags used when communicating between the eventhandler and 7 // Bit flags used when communicating between the eventhandler and
8 // dart code. The EVENT flags are used to indicate events of 8 // dart code. The EVENT flags are used to indicate events of
9 // interest when sending a message from dart code to the 9 // interest when sending a message from dart code to the
10 // eventhandler. When receiving a message from the eventhandler the 10 // eventhandler. When receiving a message from the eventhandler the
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (_seenFirstOutEvent) { 544 if (_seenFirstOutEvent) {
545 _onWrite = _clientWriteHandler; 545 _onWrite = _clientWriteHandler;
546 } else { 546 } else {
547 _onWrite = firstWriteHandler; 547 _onWrite = firstWriteHandler;
548 } 548 }
549 } 549 }
550 } 550 }
551 551
552 int get remotePort() { 552 int get remotePort() {
553 if (_remotePort === null) { 553 if (_remotePort === null) {
554 _remotePort = _getRemotePort(); 554 remoteHost;
555 } 555 }
556 return _remotePort; 556 return _remotePort;
557 } 557 }
558 558
559 int _getRemotePort() native "Socket_GetRemotePort"; 559 String get remoteHost() {
560 if (_remoteHost === null) {
561 List peer = _getRemotePeer();
562 _remoteHost = peer[0];
563 _remotePort = peer[1];
564 }
565 return _remoteHost;
566 }
567
568 List _getRemotePeer() native "Socket_GetRemotePeer";
560 569
561 static SendPort _newServicePort() native "Socket_NewServicePort"; 570 static SendPort _newServicePort() native "Socket_NewServicePort";
562 571
563 static void _ensureSocketService() { 572 static void _ensureSocketService() {
564 if (_socketService == null) { 573 if (_socketService == null) {
565 _socketService = _Socket._newServicePort(); 574 _socketService = _Socket._newServicePort();
566 } 575 }
567 } 576 }
568 577
569 bool _seenFirstOutEvent = false; 578 bool _seenFirstOutEvent = false;
570 bool _pipe = false; 579 bool _pipe = false;
571 Function _clientConnectHandler; 580 Function _clientConnectHandler;
572 Function _clientWriteHandler; 581 Function _clientWriteHandler;
573 SocketInputStream _inputStream; 582 SocketInputStream _inputStream;
574 SocketOutputStream _outputStream; 583 SocketOutputStream _outputStream;
584 String _remoteHost;
575 int _remotePort; 585 int _remotePort;
576 static SendPort _socketService; 586 static SendPort _socketService;
577 } 587 }
OLDNEW
« no previous file with comments | « runtime/bin/socket.dart ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698