Mercurial > 510Connectbot
diff src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 29:017eeed8332c tn5250
start tn5250 integration
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 03 Jun 2014 16:02:29 -0700 |
parents | 0ce5cc452d02 |
children | 139394237973 |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Tue Jun 03 12:38:59 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalBridge.java Tue Jun 03 16:02:29 2014 -0700 @@ -307,12 +307,6 @@ resetColors(); buffer.setDisplay(this); selectionArea = new SelectionArea(); - keyListener = new TerminalKeyListener(manager, this, buffer, host.getEncoding()); - - String monitor_init = host.getMonitor(); - if ((monitor_init != null) && (monitor_init.length() > 0)) { - monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init); - } } public PromptHelper getPromptHelper() { @@ -323,11 +317,17 @@ * Spawn thread to open connection and start login process. */ protected void startConnection() { - transport = TransportFactory.getTransport(host.getProtocol()); + transport = TransportFactory.getTransport(host.getProtocol()); + keyListener = transport.getTerminalKeyListener(manager, this, buffer, host.getEncoding()); + + String monitor_init = host.getMonitor(); + if ((monitor_init != null) && (monitor_init.length() > 0)) { + monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init); + } + transport.setBridge(this); transport.setManager(manager); transport.setHost(host); - // TODO make this more abstract so we don't litter on AbsTransport transport.setCompression(host.getCompression()); transport.setHttpproxy(host.getHttpproxy()); transport.setUseAuthAgent(host.getUseAuthAgent()); @@ -441,11 +441,15 @@ buffer.setBackspace(vt320.DELETE_IS_DEL); // create thread to relay incoming connection data to buffer - relay = new Relay(this, transport, buffer, host.getEncoding()); - Thread relayThread = new Thread(relay); - relayThread.setDaemon(true); - relayThread.setName("Relay"); - relayThread.start(); + // only if needed by the transport + if (transport.needsRelay()) { + relay = new Relay(this, transport, buffer, host.getEncoding()); + Thread relayThread = new Thread(relay); + relayThread.setDaemon(true); + relayThread.setName("Relay"); + relayThread.start(); + } + // force font-size to make sure we resizePTY as needed setFontSize(fontSize); // finally send any post-login string, if requested @@ -675,7 +679,7 @@ Log.e(TAG, "Problem while trying to resize screen or PTY", e); } - // redraw local output if we don't have a sesson to receive our resize request + // redraw local output if we don't have a session to receive our resize request if (transport == null) { synchronized (localOutput) { buffer.reset();