Cleanup ssh_handle_packets().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@474 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
118d4ee131
Коммит
16084e548e
@ -232,26 +232,33 @@ void ssh_set_fd_except(SSH_SESSION *session) {
|
|||||||
/** \warning I don't remember if this should be internal or not
|
/** \warning I don't remember if this should be internal or not
|
||||||
*/
|
*/
|
||||||
/* looks if there is data to read on the socket and parse it. */
|
/* looks if there is data to read on the socket and parse it. */
|
||||||
int ssh_handle_packets(SSH_SESSION *session){
|
int ssh_handle_packets(SSH_SESSION *session) {
|
||||||
int w,err,r,i=0;
|
int w = 0;
|
||||||
enter_function();
|
int e = 0;
|
||||||
do {
|
int rc = -1;
|
||||||
r=ssh_socket_poll(session->socket,&w,&err);
|
|
||||||
if(r<=0){
|
enter_function();
|
||||||
leave_function();
|
|
||||||
return r; // error or no data available
|
do {
|
||||||
}
|
rc = ssh_socket_poll(session->socket, &w, &e);
|
||||||
/* if an exception happened, it will be trapped by packet_read() */
|
if (rc <= 0) {
|
||||||
if ((packet_read(session) != SSH_OK) ||
|
/* error or no data available */
|
||||||
(packet_translate(session) != SSH_OK)) {
|
leave_function();
|
||||||
leave_function();
|
return rc;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
packet_parse(session);
|
/* if an exception happened, it will be trapped by packet_read() */
|
||||||
++i;
|
if ((packet_read(session) != SSH_OK) ||
|
||||||
} while(r>0);
|
(packet_translate(session) != SSH_OK)) {
|
||||||
leave_function();
|
leave_function();
|
||||||
return r;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet_parse(session);
|
||||||
|
} while(rc > 0);
|
||||||
|
|
||||||
|
leave_function();
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief get session status
|
/** \brief get session status
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user