Get all the MD5 key generation/matching functional for the server/bridge. Also add an internal 1 minute timer to the bridge connections just to check/remove any broken connections as necessary.

This commit is contained in:
Ken Moore
2016-05-23 10:31:49 -04:00
parent 376a903991
commit 2ac91c7c70
4 changed files with 34 additions and 11 deletions

View File

@@ -115,7 +115,7 @@ QString BridgeServer::generateID(QString name){
void BridgeServer::NewSocketConnection(){
BridgeConnection *sock = 0;
if(this->hasPendingConnections()){
qDebug() << "New incoming connection..";
//qDebug() << "New incoming connection..";
QWebSocket *ws = this->nextPendingConnection();
if(allowConnection(ws->peerAddress()) ){
QString name = ws->peerName();
@@ -200,15 +200,16 @@ void BridgeServer::announceKeyChange(QString ID, bool isServer, QStringList keys
QStringList IDs;
for(int i=0; i<OpenSockets.length(); i++){
if(i==c){ continue; } //current socket
if(!OpenSockets[i]->isActive()){ continue; } //skip right now (probably waiting on a signal that the connection closed)
else if(OpenSockets[i]->isServer() != server){ //look for a server/client pair
//compare keys to look for matches
/*QStringList chkkeys = OpenSockets[i ]->validKeySums();
QStringList chkkeys = OpenSockets[i ]->validKeySums();
chkkeys.removeDuplicates();
qDebug() << "Known Keys for ID:" << OpenSockets[i]->ID() << chkkeys;
//qDebug() << "Known Keys for ID:" << OpenSockets[i]->ID() << chkkeys;
chkkeys << keys;
if(chkkeys.removeDuplicates() > 0){ */
if(chkkeys.removeDuplicates() > 0){
IDs << OpenSockets[i]->ID();
//}
}
}
}//end inner loop of sockets
OpenSockets[c]->announceIDAvailability(IDs);