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

Unified Diff: extensions/browser/api/sockets_udp/sockets_udp_api.cc

Issue 965613002: Open a firewall hole when a TCP server or UDP socket is bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 9 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
« no previous file with comments | « extensions/browser/api/sockets_udp/sockets_udp_api.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/sockets_udp/sockets_udp_api.cc
diff --git a/extensions/browser/api/sockets_udp/sockets_udp_api.cc b/extensions/browser/api/sockets_udp/sockets_udp_api.cc
index d213ffddbe2f707f850d1bfd9e4446a6c43cbe97..b269aa8d750fcca474b2102a9051569f944a7f1f 100644
--- a/extensions/browser/api/sockets_udp/sockets_udp_api.cc
+++ b/extensions/browser/api/sockets_udp/sockets_udp_api.cc
@@ -185,10 +185,11 @@ bool SocketsUdpBindFunction::Prepare() {
return socket_event_dispatcher_ != NULL;
}
-void SocketsUdpBindFunction::Work() {
+void SocketsUdpBindFunction::AsyncWorkStart() {
ResumableUDPSocket* socket = GetUdpSocket(params_->socket_id);
if (!socket) {
error_ = kSocketNotFoundError;
+ AsyncWorkCompleted();
return;
}
@@ -196,18 +197,22 @@ void SocketsUdpBindFunction::Work() {
SocketPermissionRequest::UDP_BIND, params_->address, params_->port);
if (!SocketsManifestData::CheckRequest(extension(), param)) {
error_ = kPermissionError;
+ AsyncWorkCompleted();
return;
}
int net_result = socket->Bind(params_->address, params_->port);
+ results_ = sockets_udp::Bind::Results::Create(net_result);
if (net_result == net::OK) {
socket_event_dispatcher_->OnSocketBind(extension_->id(),
params_->socket_id);
+ } else {
+ error_ = net::ErrorToString(net_result);
+ AsyncWorkCompleted();
+ return;
}
- if (net_result != net::OK)
- error_ = net::ErrorToString(net_result);
- results_ = sockets_udp::Bind::Results::Create(net_result);
+ OpenFirewallHole(params_->address, params_->socket_id, socket);
}
SocketsUdpSendFunction::SocketsUdpSendFunction() : io_buffer_size_(0) {}
« no previous file with comments | « extensions/browser/api/sockets_udp/sockets_udp_api.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698