changeset 477:d7461da8145b stable-1.9.3-9

only bind to the MonitorService for localhost monitor connections
author Carl Byington <carl@five-ten-sg.com>
date Sun, 20 Oct 2019 14:47:27 -0700
parents 186d340afd3b
children 6cfe062ab65f 3a83f40439d7
files app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Sun Oct 20 14:19:17 2019 -0700
+++ b/app/src/main/java/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Sun Oct 20 14:47:27 2019 -0700
@@ -189,7 +189,9 @@
         public void onServiceConnected(ComponentName className, IBinder service) {
             bound = service;
             Log.i(TAG, "bound to service");
-
+            DoConnect();
+        }
+        public void DoConnect() {
             try {
                 InetAddress serverAddr = InetAddress.getByName(target);
                 int tries = 0;
@@ -284,10 +286,16 @@
         keymap.put(0x85, vt320.KEY_F22);         // vk_f22
         keymap.put(0x86, vt320.KEY_F23);         // vk_f23
         keymap.put(0x87, vt320.KEY_F24);         // vk_f24
-        // bind to the monitor service
-        Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService");
-        intent.setPackage("com.five_ten_sg.connectbot.monitor");
-        parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE);
+        if (target == "localhost") {
+            // bind to the monitor service for localhost connections
+            Intent intent = new Intent("com.five_ten_sg.connectbot.monitor.MonitorService");
+            intent.setPackage("com.five_ten_sg.connectbot.monitor");
+            parent.bindService(intent, monitor_connection, Context.BIND_AUTO_CREATE);
+        }
+        else {
+            // direct socket connection to external device
+            monitor_connection.DoConnect();
+        }
         Log.i(TAG, "constructor");
     }