Chromium Code Reviews| Index: ppapi/proxy/udp_socket_resource_base.cc |
| diff --git a/ppapi/proxy/udp_socket_resource_base.cc b/ppapi/proxy/udp_socket_resource_base.cc |
| index 521a6e2f4e284220d649e8d49934f503b6245127..cd201ba1056ac2c27af867a98979d89d206889ab 100644 |
| --- a/ppapi/proxy/udp_socket_resource_base.cc |
| +++ b/ppapi/proxy/udp_socket_resource_base.cc |
| @@ -34,6 +34,7 @@ UDPSocketResourceBase::UDPSocketResourceBase(Connection connection, |
| bool private_api) |
| : PluginResource(connection, instance), |
| private_api_(private_api), |
| + bind_called_(false), |
| bound_(false), |
| closed_(false), |
| read_buffer_(NULL), |
| @@ -61,6 +62,7 @@ UDPSocketResourceBase::~UDPSocketResourceBase() { |
| int32_t UDPSocketResourceBase::SetOptionImpl( |
| PP_UDPSocket_Option name, |
| const PP_Var& value, |
| + bool check_bind_state, |
| scoped_refptr<TrackedCallback> callback) { |
| if (closed_) |
| return PP_ERROR_FAILED; |
| @@ -69,7 +71,7 @@ int32_t UDPSocketResourceBase::SetOptionImpl( |
| switch (name) { |
| case PP_UDPSOCKET_OPTION_ADDRESS_REUSE: |
|
bbudge
2014/12/09 18:37:38
In the UDP IDL file, the documentation doesn't say
hidehiko
2014/12/09 19:51:42
First, I thought it was not necessary, because mes
|
| case PP_UDPSOCKET_OPTION_BROADCAST: { |
| - if (bound_) |
| + if (check_bind_state && bind_called_) |
|
bbudge
2014/12/09 18:37:38
You should add a comment about *why* you use bind_
hidehiko
2014/12/09 19:51:42
Done.
|
| return PP_ERROR_FAILED; |
| if (value.type != PP_VARTYPE_BOOL) |
| return PP_ERROR_BADARGUMENT; |
| @@ -78,7 +80,7 @@ int32_t UDPSocketResourceBase::SetOptionImpl( |
| } |
| case PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE: |
| case PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE: { |
| - if (!bound_) |
| + if (check_bind_state && !bound_) |
| return PP_ERROR_FAILED; |
| if (value.type != PP_VARTYPE_INT32) |
| return PP_ERROR_BADARGUMENT; |
| @@ -111,6 +113,7 @@ int32_t UDPSocketResourceBase::BindImpl( |
| if (TrackedCallback::IsPending(bind_callback_)) |
| return PP_ERROR_INPROGRESS; |
| + bind_called_ = true; |
| bind_callback_ = callback; |
| // Send the request, the browser will call us back via BindReply. |