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

Issue 2378763003: Add ability to reuse address in chrome.sockets.udp

Created:
4 years, 2 months ago by srsudar
Modified:
4 years, 2 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add ability to reuse address in chrome.sockets.udp This commit adds the ability to flag that a socket allows address reuse. Reusing an address is permitted by UDP, and exposing this functionality allows Apps to do things like implement an mDNS server. The mDNS address is bound by Chrome by default, and despite the fact that when binding Chrome flags the address as reusable, before this change Apps are unable to indicate that they too permit address reuse. This is only available in the newer chrome.sockets.udp API, and thus is only implemented in ResumableUDPSocket. BUG=497875 R=reillyg@chromium.org R=rockot@chromium.org

Patch Set 1 #

Total comments: 4

Patch Set 2 : Respond to code review #

Total comments: 6

Patch Set 3 : Respond to code reviews, clean up tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+89 lines, -3 lines) Patch
M extensions/browser/api/socket/udp_socket.h View 1 2 chunks +7 lines, -0 lines 0 comments Download
M extensions/browser/api/socket/udp_socket.cc View 1 2 chunks +6 lines, -1 line 0 comments Download
M extensions/browser/api/sockets_udp/sockets_udp_api.cc View 2 chunks +4 lines, -0 lines 0 comments Download
M extensions/common/api/sockets_udp.idl View 2 chunks +6 lines, -0 lines 0 comments Download
M extensions/test/data/sockets_udp/api/background.js View 1 2 2 chunks +66 lines, -2 lines 0 comments Download

Messages

Total messages: 18 (8 generated)
srsudar
On 2016/09/28 23:10:39, commit-bot: I haz the power wrote: > Dry run: Try jobs failed ...
4 years, 2 months ago (2016-09-28 23:15:38 UTC) #9
Reilly Grant (use Gerrit)
This looks like it's on the right track. Since this is adding a new API ...
4 years, 2 months ago (2016-09-29 06:55:55 UTC) #10
srsudar
On 2016/09/29 06:55:55, Reilly Grant wrote: > This looks like it's on the right track. ...
4 years, 2 months ago (2016-09-29 15:53:31 UTC) #11
srsudar
https://codereview.chromium.org/2378763003/diff/1/extensions/browser/api/socket/udp_socket.h File extensions/browser/api/socket/udp_socket.h (right): https://codereview.chromium.org/2378763003/diff/1/extensions/browser/api/socket/udp_socket.h#newcode123 extensions/browser/api/socket/udp_socket.h:123: bool allow_address_reuse_; On 2016/09/29 06:55:55, Reilly Grant wrote: > ...
4 years, 2 months ago (2016-09-29 19:32:58 UTC) #12
carlosk
This is not an area of the codebase I know so my comments are more ...
4 years, 2 months ago (2016-09-30 02:16:24 UTC) #13
Reilly Grant (use Gerrit)
On 2016/09/29 at 15:53:31, srsudar wrote: > On 2016/09/29 06:55:55, Reilly Grant wrote: > > ...
4 years, 2 months ago (2016-09-30 07:25:30 UTC) #14
srsudar
https://codereview.chromium.org/2378763003/diff/20001/extensions/test/data/sockets_udp/api/background.js File extensions/test/data/sockets_udp/api/background.js (right): https://codereview.chromium.org/2378763003/diff/20001/extensions/test/data/sockets_udp/api/background.js#newcode89 extensions/test/data/sockets_udp/api/background.js:89: function onGetInfoBeforeBind(info) { On 2016/09/30 02:16:24, carlosk wrote: > ...
4 years, 2 months ago (2016-09-30 15:07:17 UTC) #15
carlosk
Non-owner LGTM.
4 years, 2 months ago (2016-09-30 18:30:23 UTC) #16
srsudar
On 2016/09/30 07:25:30, Reilly Grant wrote: > On 2016/09/29 at 15:53:31, srsudar wrote: > > ...
4 years, 2 months ago (2016-09-30 20:04:33 UTC) #17
Reilly Grant (use Gerrit)
4 years, 2 months ago (2016-10-03 03:25:49 UTC) #18
On 2016/09/30 at 20:04:33, srsudar wrote:
> On 2016/09/30 07:25:30, Reilly Grant wrote:
> > On 2016/09/29 at 15:53:31, srsudar wrote:
> > > On 2016/09/29 06:55:55, Reilly Grant wrote:
> > > > This looks like it's on the right track. Since this is adding a new API
> > feature
> > > > with possible security implications please follow the process documented
> > here to
> > > > send a proposal to apps-dev@ and security-enamel@:
> > > > 
> > > >
> >
https://www.chromium.org/developers/design-documents/extensions/proposed-chan...
> > > > 
> > > > The proposal will be simpler that normal since you are extending an
existing
> > > > API.
> > > > 
> > > >
> >
https://codereview.chromium.org/2378763003/diff/1/extensions/browser/api/sock...
> > > > File extensions/browser/api/socket/udp_socket.h (right):
> > > > 
> > > >
> >
https://codereview.chromium.org/2378763003/diff/1/extensions/browser/api/sock...
> > > > extensions/browser/api/socket/udp_socket.h:123: bool
allow_address_reuse_;
> > > > Instead of adding this field to ResumableUDPSocket add it to UDPSocket
and
> > then
> > > > you don't need an IsReusable() method.
> > > > 
> > > >
> >
https://codereview.chromium.org/2378763003/diff/1/extensions/test/data/socket...
> > > > File extensions/test/data/sockets_udp/api/background.js (right):
> > > > 
> > > >
> >
https://codereview.chromium.org/2378763003/diff/1/extensions/test/data/socket...
> > > > extensions/test/data/sockets_udp/api/background.js:110: 'Not all sockets
> > created
> > > > during test');
> > > > This assert is vacuously true. I assume you meant to test that
> > numSocketsCreated
> > > > == numSocketsExpected. numSocketsCreated should probably be incremented
in
> > > > onGetInfoAfterBind() instead of createAndBindToSharedAddress().
> > > 
> > > Will do. Any idea as to why AllowAddressReuse() doesn't seem to be working
on
> > the Windows tests? I believe error 147 is address in use, or at least it was
the
> > same on my linux workstation after adding the test but before implementing
> > support. Strangely in the previous CL a few years ago it was the Mac tests
that
> > were failing. I don't see any changes in the log for udp_socket_win.cc that
look
> > relevant to me, but I could be missing them.
> > 
> > IIRC the address reuse flags mean something different in Windows vs. POSIX.
> 
> Based on the interface and comments in udp_socket_win.h, I'd expect vagaries
of flags across platforms to be handled by the AllowAddressReuse() function. I'm
not dealing with any of the flags myself but instead relying on that function.
Of course, the failing tests might suggest this is the wrong approach. Here is
the relevant line:
> 
>
https://cs.chromium.org/chromium/src/net/udp/udp_socket_win.h?q=udp_socket_wi...
> 
> Is it worth emailing the OWNERS of that file for their take? This might be
exactly the thing that killed the previous CL to add this functionality, but I'd
love to be able to leave a bit more understanding for posterity at the least.

You should ask about this on net-dev@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698