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

Unified Diff: runtime/bin/socket_impl.dart

Issue 8399039: Explicitly handle listen sockets and connection sockets differently in Linux and Mac OS eventhandler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Mac OS build Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/eventhandler_linux.cc ('K') | « runtime/bin/eventhandler_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_impl.dart
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_impl.dart
index fa5e897aa164f099a39757e8ba358944230a9d65..62dd538e68b7e9716d9ee5d96aba42b69c601d1c 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -15,7 +15,9 @@ class _SocketBase {
static final int _FIRST_EVENT = _IN_EVENT;
static final int _LAST_EVENT = _CLOSE_EVENT;
- static final int _CLOSE_COMMAND = 4;
+ static final int _CLOSE_COMMAND = 8;
+
+ static final int _LISTEN_SOCKET = 16;
_SocketBase () {
_handler = new ReceivePort();
@@ -72,7 +74,9 @@ class _SocketBase {
void _doActivateHandlers() {
if (_canActivateHandlers && (_id >= 0)) {
- EventHandler._sendData(_id, _handler, _handlerMask);
+ int data = _handlerMask;
+ if (_isListenSocket()) data |= (1 << _LISTEN_SOCKET);
+ EventHandler._sendData(_id, _handler, data);
}
}
@@ -106,6 +110,7 @@ class _SocketBase {
}
}
+ abstract bool _isListenSocket();
/*
* Socket id is set from native. -1 indicates that the socket was closed.
@@ -180,6 +185,8 @@ class _ServerSocket extends _SocketBase implements ServerSocket {
void setConnectionHandler(void callback()) {
_setHandler(_IN_EVENT, callback);
}
+
+ bool _isListenSocket() => true;
}
@@ -275,6 +282,8 @@ class _Socket extends _SocketBase implements Socket {
_setHandler(_CLOSE_EVENT, callback);
}
+ bool _isListenSocket() => false;
+
InputStream get inputStream() {
if (_inputStream == null) {
_inputStream = new SocketInputStream(this);
« runtime/bin/eventhandler_linux.cc ('K') | « runtime/bin/eventhandler_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698