summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorP. F. Chimento <philip.chimento@gmail.com>2017-02-16 14:28:27 -0800
committerGitHub <noreply@github.com>2017-02-16 14:28:27 -0800
commit9f9086febf25e0ad6069afd76d56ce412df3eb33 (patch)
tree9e0a19a8576759f1252c9a61e1e10c08bb02ab74
parentf2e5d2d5a918007df79cc811ce978ab4e21f59d5 (diff)
parent9cacf2e1ff52a8c5a3e90c4271c56e357ba57367 (diff)
Merge pull request #4158 from endlessm/T15612
Remove doConnectionTestAsync() https://phabricator.endlessm.com/T15612
-rw-r--r--overrides/Endless.js2
-rw-r--r--overrides/endless_private/connection_test.js46
2 files changed, 0 insertions, 48 deletions
diff --git a/overrides/Endless.js b/overrides/Endless.js
index a835838..67d1efb 100644
--- a/overrides/Endless.js
+++ b/overrides/Endless.js
@@ -24,7 +24,6 @@ function getCurrentFileDir() {
imports.searchPath.unshift(getCurrentFileDir());
const AssetButton = imports.endless_private.asset_button;
-const ConnectionTest = imports.endless_private.connection_test;
const SearchBox = imports.endless_private.search_box;
const TopbarHomeButton = imports.endless_private.topbar_home_button;
const TopbarNavButton = imports.endless_private.topbar_nav_button;
@@ -34,7 +33,6 @@ function _init() {
Endless = this;
Endless.getCurrentFileDir = getCurrentFileDir;
Endless.AssetButton = AssetButton.AssetButton;
- Endless.doConnectionTestAsync = ConnectionTest.doConnectionTestAsync;
Endless.SearchBox = SearchBox.SearchBox;
Endless.TopbarHomeButton = TopbarHomeButton.TopbarHomeButton;
Endless.TopbarNavButton = TopbarNavButton.TopbarNavButton;
diff --git a/overrides/endless_private/connection_test.js b/overrides/endless_private/connection_test.js
deleted file mode 100644
index ce2e0f9..0000000
--- a/overrides/endless_private/connection_test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-const Gio = imports.gi.Gio;
-
-// Performs a connection test by first looking for an available connection, and
-// performing a ping test with address parameters specified by hostname, scheme,
-// and port. The test is performed asynchronously.
-// successCallback, failureCallback, and errorCallback are optional parameters
-// and are called in their relevent outcome cases. If the ping test completed,
-// the userData will be passed to the callbacks. Additionally, the errorCallback
-// will recieve the error as the first argument.
-// If an errorCallback is not provided, errors will be re-thrown (with the
-// exception of a Gio.ResolverError, which is a connection failure).
-function doConnectionTestAsync(hostname, scheme, port, connectionSuccessCallback,
- connectionFailureCallback,
- errorCallback) {
- let network_monitor = Gio.NetworkMonitor.get_default();
- let network_address = new Gio.NetworkAddress({
- 'hostname': hostname,
- 'scheme': scheme,
- 'port': port
- });
-
- if (network_monitor.get_network_available()) {
- network_monitor.can_reach_async(network_address, null,
- function(userData, asyncResult) {
- try {
- let ping_success = network_monitor.
- can_reach_finish(asyncResult, null);
- if (ping_success && connectionSuccessCallback) {
- connectionSuccessCallback(userData);
- } else if (!ping_success && connectionFailureCallback) {
- connectionFailureCallback(userData);
- }
- } catch (err) {
- if (err instanceof Gio.ResolverError) {
- connectionFailureCallback(userData);
- } else if (errorCallback) {
- errorCallback(err, userData);
- } else {
- throw err;
- }
- }
- });
- } else if (connectionFailureCallback) {
- connectionFailureCallback();
- }
-}