reconnecting fix

This commit is contained in:
liranbg 2014-09-22 00:53:28 +03:00
parent b4559f5182
commit 68bd693dd8
2 changed files with 33 additions and 8 deletions

View file

@ -205,7 +205,7 @@ void jceSSLClient::setConnected()
*/ */
void jceSSLClient::setDisconnected() void jceSSLClient::setDisconnected()
{ {
qDebug() << Q_FUNC_INFO << "DISCONNECTED"; qDebug() << Q_FUNC_INFO << "connection has been DISCONNECTED";
this->setSocketState(QAbstractSocket::SocketState::UnconnectedState); this->setSocketState(QAbstractSocket::SocketState::UnconnectedState);
packet.clear(); packet.clear();
flag = false; flag = false;
@ -218,7 +218,7 @@ void jceSSLClient::setDisconnected()
*/ */
void jceSSLClient::setEncrypted() void jceSSLClient::setEncrypted()
{ {
qDebug() << Q_FUNC_INFO << "ENCRYPTED"; qDebug() << Q_FUNC_INFO << "connection has been ENCRYPTED";
setReadBufferSize(10000); setReadBufferSize(10000);
setSocketOption(QAbstractSocket::KeepAliveOption,true); setSocketOption(QAbstractSocket::KeepAliveOption,true);
flag = true; flag = true;

View file

@ -31,14 +31,15 @@ void jceLogin::makeConnection() throw (jceStatus)
if (this->recieverPage == NULL) if (this->recieverPage == NULL)
this->recieverPage = new QString(); this->recieverPage = new QString();
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
throw jceStatus::ERROR_ON_OPEN_SOCKET;
int returnMode; //gets status according to called function of validation step int returnMode; //gets status according to called function of validation step
jceStatus status = jceStatus::JCE_NOT_CONNECTED; jceStatus status = jceStatus::JCE_NOT_CONNECTED;
returnMode = checkConnection(); //checking socket status. is connected? returnMode = checkConnection(); //checking socket status. is connected?
if (returnMode == false)
if (JceConnector->makeConnect(dst_host,dst_port) == false) //couldnt make a connection
throw jceStatus::ERROR_ON_OPEN_SOCKET;
if (returnMode == true) //connected to host if (returnMode == true) //connected to host
{ {
returnMode = makeFirstVisit(); returnMode = makeFirstVisit();
@ -292,10 +293,34 @@ QString jceLogin::getPage()
void jceLogin::reValidation() void jceLogin::reValidation()
{ {
qDebug() << Q_FUNC_INFO << "Revalidating user"; qDebug() << Q_FUNC_INFO << "Revalidating user";
if (makeFirstVisit()) if (makeFirstVisit() == true)
{ {
if (makeSecondVisit()) if (checkValidation())
qDebug() << Q_FUNC_INFO << "Validated"; {
if (makeSecondVisit() == true)
qDebug() << Q_FUNC_INFO << "Validated";
else
qWarning() << Q_FUNC_INFO << "Second visit finished with an error";
}
else
qDebug() << Q_FUNC_INFO << "checking validation ended with an error";
} }
else
{
qDebug() << Q_FUNC_INFO << "Couldnt Validate User";
}
/*
delete recieverPage;
recieverPage = NULL;
if (this->JceConnector != NULL)
delete JceConnector;
this->recieverPage = new QString();
this->JceConnector = new jceSSLClient();
if (makeFirstVisit() == true)
{
if (checkValidation())
{
if (makeSecondVisit() == true)
*/
} }