Add support for the server to become the initiator in a client->bridge connection. The bridge setting to use are still not implemented yet, and the new bridge-specific SSL key pair still needs to be created on first run.

This commit is contained in:
Ken Moore
2016-05-11 15:29:37 -04:00
parent 9012c7cb57
commit 916069ce69
6 changed files with 118 additions and 8 deletions

View File

@@ -15,6 +15,9 @@ WebServer::WebServer(){
//Setup all the various settings
WSServer = 0;
TCPServer = 0;
bridgeTimer = new QTimer(this);
bridgeTimer->setInterval(5*60*1000); //5 minutes
connect(bridgeTimer, SIGNAL(timeout()), this, SLOT(checkBridges()) );
AUTH = new AuthorizationManager();
connect(AUTH, SIGNAL(BlockHost(QHostAddress)), this, SLOT(BlackListConnection(QHostAddress)) );
}
@@ -30,7 +33,7 @@ bool WebServer::startServer(quint16 port, bool websocket){
qDebug() << " - Version:" << QSslSocket::sslLibraryVersionString();
}
bool ok = false;
if(websocket){ ok = setupWebSocket(port); }
if(websocket){ ok = setupWebSocket(port); }
else{ ok = setupTcp(port); }
if(ok){
@@ -41,11 +44,15 @@ bool WebServer::startServer(quint16 port, bool websocket){
}else{
qCritical() << "Could not start server - exiting...";
}
if(ok && websocket){
bridgeTimer->start();
QTimer::singleShot(5, this, SLOT(checkBridges()));
}
return ok;
}
void WebServer::stopServer(){
if(bridgeTimer->isActive()){ bridgeTimer->stop(); }
if(WSServer!=0){ WSServer->close(); } //note - this will throw the "closed()" signal when done
else if(TCPServer!=0){ TCPServer->close(); QCoreApplication::exit(0);} //no corresponding signal
}
@@ -206,3 +213,8 @@ void WebServer::SocketClosed(QString ID){
}
QTimer::singleShot(0,this, SLOT(NewSocketConnection()) ); //check for a new connection
}
// BRIDGE Connection checks
void WebServer::checkBridges(){
}