()
| 723 | } |
| 724 | |
| 725 | protected void sendChannelOpen() throws Exception { |
| 726 | Session _session=getSession(); |
| 727 | if(!_session.isConnected()){ |
| 728 | throw new JSchException("session is down"); |
| 729 | } |
| 730 | |
| 731 | Packet packet = genChannelOpenPacket(); |
| 732 | _session.write(packet); |
| 733 | |
| 734 | int retry=2000; |
| 735 | long start=System.currentTimeMillis(); |
| 736 | long timeout=connectTimeout; |
| 737 | if(timeout!=0L) retry = 1; |
| 738 | synchronized(this){ |
| 739 | while(this.getRecipient()==-1 && |
| 740 | _session.isConnected() && |
| 741 | retry>0){ |
| 742 | if(timeout>0L){ |
| 743 | if((System.currentTimeMillis()-start)>timeout){ |
| 744 | retry=0; |
| 745 | continue; |
| 746 | } |
| 747 | } |
| 748 | try{ |
| 749 | long t = timeout==0L ? 10L : timeout; |
| 750 | this.notifyme=1; |
| 751 | wait(t); |
| 752 | } |
| 753 | catch(java.lang.InterruptedException e){ |
| 754 | } |
| 755 | finally{ |
| 756 | this.notifyme=0; |
| 757 | } |
| 758 | retry--; |
| 759 | } |
| 760 | } |
| 761 | if(!_session.isConnected()){ |
| 762 | throw new JSchException("session is down"); |
| 763 | } |
| 764 | if(this.getRecipient()==-1){ // timeout |
| 765 | throw new JSchException("channel is not opened."); |
| 766 | } |
| 767 | if(this.open_confirmation==false){ // SSH_MSG_CHANNEL_OPEN_FAILURE |
| 768 | throw new JSchException("channel is not opened."); |
| 769 | } |
| 770 | connected=true; |
| 771 | } |
| 772 | } |
no test coverage detected