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

Issue 9699017: Start better error reporting for sockets (Closed)

Created:
8 years, 9 months ago by Søren Gjesse
Modified:
8 years, 9 months ago
Reviewers:
Mads Ager (google)
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Start better error reporting for sockets Changed the onError callback for sockets to take an exception argument. First area to report errors for is name resolution. Changed the IP address resolution from being synchronous with the creation of the socket to being asynchronous thsough a lookup service running on a native port. Currently this lookup service is static on the socket class as we need to call it from a factory method. We should probably add a separate name lookup service at some point. R=ager@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=5640

Patch Set 1 #

Patch Set 2 : Added tests #

Total comments: 20

Patch Set 3 : Addressed review comments #

Patch Set 4 : Fixed bug #

Unified diffs Side-by-side diffs Delta from patch set Stats (+491 lines, -173 lines) Patch
M runtime/bin/builtin_natives.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/bin/dartutils.h View 1 chunk +2 lines, -0 lines 0 comments Download
M runtime/bin/dartutils.cc View 1 chunk +6 lines, -2 lines 0 comments Download
M runtime/bin/http.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/http_impl.dart View 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/bin/socket.h View 2 chunks +18 lines, -0 lines 0 comments Download
M runtime/bin/socket.cc View 1 2 chunks +88 lines, -2 lines 0 comments Download
M runtime/bin/socket.dart View 1 2 4 chunks +21 lines, -6 lines 0 comments Download
M runtime/bin/socket_impl.dart View 1 2 10 chunks +69 lines, -19 lines 0 comments Download
M runtime/bin/socket_linux.cc View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
M runtime/bin/socket_macos.cc View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
M runtime/bin/socket_win.cc View 1 2 1 chunk +34 lines, -0 lines 0 comments Download
M runtime/bin/utils.h View 1 2 3 2 chunks +13 lines, -2 lines 0 comments Download
M runtime/bin/utils_linux.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/bin/utils_macos.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/bin/utils_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/src/io/EchoServerStreamTest.dart View 2 chunks +4 lines, -4 lines 0 comments Download
M tests/standalone/src/io/EchoServerTest.dart View 2 chunks +4 lines, -4 lines 0 comments Download
M tests/standalone/src/io/SocketCloseTest.dart View 3 chunks +4 lines, -4 lines 0 comments Download
M tests/standalone/src/io/SocketExceptionTest.dart View 1 3 chunks +141 lines, -114 lines 0 comments Download
M tests/standalone/src/io/SocketManyConnectionsTest.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M tests/standalone/src/io/SocketStreamCloseTest.dart View 3 chunks +3 lines, -3 lines 0 comments Download
M tests/standalone/src/io/StreamPipeTest.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/src/io/TestingServer.dart View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Gjesse
8 years, 9 months ago (2012-03-14 10:46:19 UTC) #1
Mads Ager (google)
LGTM https://chromiumcodereview.appspot.com/9699017/diff/1025/runtime/bin/http_impl.dart File runtime/bin/http_impl.dart (right): https://chromiumcodereview.appspot.com/9699017/diff/1025/runtime/bin/http_impl.dart#newcode1075 runtime/bin/http_impl.dart:1075: _onError(HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR); Do interpolation as above? Or doens't it ...
8 years, 9 months ago (2012-03-14 12:51:50 UTC) #2
Søren Gjesse
8 years, 9 months ago (2012-03-19 10:05:42 UTC) #3
http://codereview.chromium.org/9699017/diff/1025/runtime/bin/http_impl.dart
File runtime/bin/http_impl.dart (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/http_impl.dart#n...
runtime/bin/http_impl.dart:1075:
_onError(HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR);
On 2012/03/14 12:51:51, Mads Ager wrote:
> Do interpolation as above? Or doens't it make sense here?

For some odd reason this onError currently takes a HttpStatus. This will be
changed in an upcoming change.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/io.dart
File runtime/bin/io.dart (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/io.dart#newcode14
runtime/bin/io.dart:14: #import("dart:builtin");
On 2012/03/14 12:51:51, Mads Ager wrote:
> Debugging code?

Removed.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart
File runtime/bin/socket_impl.dart (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart...
runtime/bin/socket_impl.dart:67: eventHandler(new SocketIOException(""));
On 2012/03/14 12:51:51, Mads Ager wrote:
> I suppose next step is to find a way to actually propagate some information
> here?

Yes.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart...
runtime/bin/socket_impl.dart:270: // host on the given port. Null is returned if
file descriptor creation
On 2012/03/14 12:51:51, Mads Ager wrote:
> Update description. Maybe in the public API as well?

Done.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart...
runtime/bin/socket_impl.dart:276: request[0] = 0;
On 2012/03/14 12:51:51, Mads Ager wrote:
> Maybe create a kHostLookup constant?

Done.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart...
runtime/bin/socket_impl.dart:284: return null;
On 2012/03/14 12:51:51, Mads Ager wrote:
> No need for the null return here.
> 
> We should probably report an error here or something? We used to return null
> which the user could see. Now we don't.

Good catch. Changed to do an onError callback when initiating connecting the
socket fails.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_impl.dart...
runtime/bin/socket_impl.dart:410: onError(new Exception("Unknown error"));
On 2012/03/14 12:51:51, Mads Ager wrote:
> End the default case with a break as well.

Done.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_linux.cc
File runtime/bin/socket_linux.cc (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_linux.cc#...
runtime/bin/socket_linux.cc:128: // Convert the address into IPv4 dotted decomal
notation.
On 2012/03/14 12:51:51, Mads Ager wrote:
> decomal -> decimal

Done.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_macos.cc
File runtime/bin/socket_macos.cc (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_macos.cc#...
runtime/bin/socket_macos.cc:128: // Convert the address into IPv4 dotted decomal
notation.
On 2012/03/14 12:51:51, Mads Ager wrote:
> Ditto.

Done.

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_win.cc
File runtime/bin/socket_win.cc (right):

http://codereview.chromium.org/9699017/diff/1025/runtime/bin/socket_win.cc#ne...
runtime/bin/socket_win.cc:165: // Convert the address into IPv4 dotted decomal
notation.
On 2012/03/14 12:51:51, Mads Ager wrote:
> Ditto.

Done.

Powered by Google App Engine
This is Rietveld 408576698