comparison src/ch/ethz/ssh2/Connection.java @ 373:2768eb029d73

debug kex error
author Carl Byington <carl@five-ten-sg.com>
date Mon, 04 Aug 2014 13:08:22 -0700
parents 20d0a1356c43
children
comparison
equal deleted inserted replaced
372:20d0a1356c43 373:2768eb029d73
670 * closed, too. Can be called at any time. Don't forget to call this once 670 * closed, too. Can be called at any time. Don't forget to call this once
671 * you don't need a connection anymore - otherwise the receiver thread may 671 * you don't need a connection anymore - otherwise the receiver thread may
672 * run forever. 672 * run forever.
673 */ 673 */
674 674
675 public synchronized void close() { 675 // cannot be synchronized, since Connection.connect() is synchronized, and
676 // if the key exchange fails, another thread will try to close().
677
678 public void close() {
676 log.debug("Connection.close()"); 679 log.debug("Connection.close()");
677 Throwable t = new Throwable("Closed due to user request."); 680 Throwable t = new Throwable("Closed due to user request.");
678 close(t, false); 681 close(t, false);
679 } 682 }
680 683
681 public synchronized void close(Throwable t, boolean hard) { 684 public void close(Throwable t, boolean hard) {
682 log.debug(String.format("Connection.close(%s hard=%b)", t.getMessage(), hard)); 685 log.debug(String.format("Connection.close(%s hard=%b)", t.getMessage(), hard));
683 if (cm != null) { 686 if (cm != null) {
684 cm.closeAllChannels(); 687 cm.closeAllChannels();
685 } 688 }
686 689