1
1
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@475 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
Andreas Schneider 2009-04-14 14:50:11 +00:00
родитель 16084e548e
Коммит 8e34f0cf0c

Просмотреть файл

@ -261,21 +261,36 @@ int ssh_handle_packets(SSH_SESSION *session) {
return rc; return rc;
} }
/** \brief get session status /**
* \param session ssh session * @brief Get session status
* \returns a bitmask including SSH_CLOSED, SSH_READ_PENDING or SSH_CLOSED_ERROR *
* which respectively means the session is closed, has data to read on the connection socket and session was closed due to an error * @param session The ssh session to use.
*
* @returns A bitmask including SSH_CLOSED, SSH_READ_PENDING or SSH_CLOSED_ERROR
* which respectively means the session is closed, has data to read on
* the connection socket and session was closed due to an error.
*/ */
int ssh_get_status(SSH_SESSION *session){ int ssh_get_status(SSH_SESSION *session) {
int ret=0; int socketstate;
int socketstate=ssh_socket_get_status(session->socket); int r = 0;
if(session->closed)
ret |= SSH_CLOSED; if (session == NULL) {
if(socketstate & SSH_READ_PENDING) return 0;
ret |= SSH_READ_PENDING; }
if(session->closed && socketstate & SSH_CLOSED_ERROR)
ret |= SSH_CLOSED_ERROR; socketstate = ssh_socket_get_status(session->socket);
return ret;
if (session->closed) {
r |= SSH_CLOSED;
}
if (socketstate & SSH_READ_PENDING) {
r |= SSH_READ_PENDING;
}
if (session->closed && (socketstate & SSH_CLOSED_ERROR)) {
r |= SSH_CLOSED_ERROR;
}
return r;
} }
/** \brief get the disconnect message from the server /** \brief get the disconnect message from the server