comparison src/ch/ethz/ssh2/Connection.java @ 319:776a220dbcc6 ganymed

add ecdsa key support everywhere
author Carl Byington <carl@five-ten-sg.com>
date Thu, 31 Jul 2014 08:20:47 -0700
parents cdb3c9215a9b
children 5afb8c1a54b9
comparison
equal deleted inserted replaced
318:5351641c8a46 319:776a220dbcc6
668 * you don't need a connection anymore - otherwise the receiver thread may 668 * you don't need a connection anymore - otherwise the receiver thread may
669 * run forever. 669 * run forever.
670 */ 670 */
671 671
672 public void close() { 672 public void close() {
673 Throwable t = new Throwable("Closed due to user request.");
674 close(t, false);
675 }
676
677 public void close(Throwable t, boolean hard) {
673 if (cm != null) { 678 if (cm != null) {
674 cm.closeAllChannels(); 679 cm.closeAllChannels();
675 } 680 }
676 681
677 if (tm != null) { 682 if (tm != null) {
678 tm.close(); 683 tm.close(t, hard == false);
679 tm = null;
680 }
681
682 am = null;
683 cm = null;
684 authenticated = false;
685 }
686
687 public synchronized void close(IOException t) {
688 if (cm != null) {
689 cm.closeAllChannels();
690 }
691
692 if (tm != null) {
693 tm.close(t);
694 tm = null; 684 tm = null;
695 } 685 }
696 686
697 am = null; 687 am = null;
698 cm = null; 688 cm = null;
825 if (state.isCancelled) { 815 if (state.isCancelled) {
826 return; 816 return;
827 } 817 }
828 818
829 state.timeoutSocketClosed = true; 819 state.timeoutSocketClosed = true;
830 tm.close(new SocketTimeoutException("The connect timeout expired")); 820 tm.close(new SocketTimeoutException("The connect timeout expired"), false);
831 } 821 }
832 } 822 }
833 }; 823 };
834 long timeoutHorizont = System.currentTimeMillis() + kexTimeout; 824 long timeoutHorizont = System.currentTimeMillis() + kexTimeout;
835 token = TimeoutService.addTimeoutHandler(timeoutHorizont, timeoutHandler); 825 token = TimeoutService.addTimeoutHandler(timeoutHorizont, timeoutHandler);