File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,6 @@ private void removeForward(AdbForward forward) {
170
170
device .removeForward (forward .getPort (), forward .getLocalabstract (), IDevice .DeviceUnixSocketNamespace .ABSTRACT );
171
171
} catch (Exception e ) {
172
172
e .printStackTrace ();
173
- System .out .println ("remove forward failed" );
174
173
}
175
174
}
176
175
@@ -412,8 +411,8 @@ private void onStartup(boolean success) {
412
411
private void onClose () {
413
412
for (MinicapListener listener : listenerList ) {
414
413
listener .onClose (this );
415
- removeForward (forward );
416
414
}
415
+ removeForward (forward );
417
416
}
418
417
419
418
private void onBanner (Banner banner ) {
Original file line number Diff line number Diff line change @@ -97,6 +97,16 @@ public AdbForward createForward() {
97
97
return forward ;
98
98
}
99
99
100
+ private void removeForward (AdbForward forward ) {
101
+ if (forward == null || !forward .isForward ()) {
102
+ return ;
103
+ }
104
+ try {
105
+ device .removeForward (forward .getPort (), forward .getLocalabstract (), IDevice .DeviceUnixSocketNamespace .ABSTRACT );
106
+ } catch (Exception e ) {
107
+ }
108
+ }
109
+
100
110
public void start () {
101
111
AdbForward forward = createForward ();
102
112
String command = "/data/local/tmp/minitouch" + " -n " + forward .getLocalabstract ();
@@ -247,5 +257,6 @@ private void onClose() {
247
257
for (MinitouchListener listener : listenerList ) {
248
258
listener .onClose (this );
249
259
}
260
+ removeForward (forward );
250
261
}
251
262
}
You can’t perform that action at this time.
0 commit comments