Skip to content

Commit 1758893

Browse files
committed
Replace file with rabbit suggestion again
1 parent 338cb36 commit 1758893

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

android/app/src/main/java/betaflight/configurator/plugin/SocketPlugin.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public void connect(final PluginCall call) {
9595
} catch (Exception e) {
9696
state.set(ConnectionState.ERROR);
9797
closeResourcesInternal();
98-
state.set(ConnectionState.DISCONNECTED); // allow a new connect() attempt
9998
call.reject("Connection failed: " + e.getMessage());
10099
Log.e(TAG, "Connection failed", e);
101100
} finally {
@@ -204,14 +203,6 @@ public void disconnect(final PluginCall call) {
204203
});
205204
}
206205

207-
@PluginMethod
208-
public void getStatus(final PluginCall call) {
209-
JSObject result = new JSObject();
210-
result.put("connected", state.get() == ConnectionState.CONNECTED);
211-
result.put("state", state.get().toString());
212-
call.resolve(result);
213-
}
214-
215206
@Override
216207
protected void handleOnDestroy() {
217208
socketLock.lock();
@@ -229,13 +220,13 @@ protected void handleOnDestroy() {
229220

230221
private void closeResourcesInternal() {
231222
if (reader != null) {
232-
try { reader.close(); } catch (IOException e) { Log.e(TAG, "Error closing reader", e);} finally { reader = null; }
223+
try { reader.close(); } catch (IOException e) { Log.e(TAG, "Error closing reader", e); } finally { reader = null; }
233224
}
234225
if (writer != null) {
235-
try { writer.flush(); writer.close(); } catch (IOException e) { Log.e(TAG, "Error closing writer", e);} finally { writer = null; }
226+
try { writer.flush(); writer.close(); } catch (IOException e) { Log.e(TAG, "Error closing writer", e); } finally { writer = null; }
236227
}
237228
if (socket != null) {
238-
try { socket.close(); } catch (IOException e) { Log.e(TAG, "Error closing socket", e);} finally { socket = null; }
229+
try { socket.close(); } catch (IOException e) { Log.e(TAG, "Error closing socket", e); } finally { socket = null; }
239230
}
240231
}
241232

0 commit comments

Comments
 (0)