Commit 87513455 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Some bugs fixed and sockets keepalive enabled

parent 30b920b9
......@@ -34,7 +34,7 @@ AvahiTcpAnnouncer::AvahiTcpAnnouncer()
service = new DNSSD::PublicService(QHostInfo::localHostName(), serviceType, port);
mServer = new QTcpServer();
mServer = new QTcpServer(this);
connect(mServer,SIGNAL(newConnection()),this, SLOT(newConnection()));
mServer->listen(QHostAddress::Any, port);
......@@ -45,6 +45,7 @@ void AvahiTcpAnnouncer::newConnection()
qDebug() << "AvahiTcpAnnouncer newConnection";
QTcpSocket* socket = mServer->nextPendingConnection();
socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
connect(socket,SIGNAL(readyRead()),this,SLOT(dataReceived()));
......
......@@ -71,10 +71,6 @@ void NetworkPackage::unserialize(QByteArray a, NetworkPackage* np)
np->setVersion(-1);
}
if (np->version() > CURRENT_PACKAGE_VERSION) {
qDebug() << "Warning: package version " << np->version() << " greater than supported version " << CURRENT_PACKAGE_VERSION;
}
//QVariant -> Object
//NetworkPackage np;
//QJSon json(a);
......@@ -82,6 +78,11 @@ void NetworkPackage::unserialize(QByteArray a, NetworkPackage* np)
//np.mType = json["type"];
//np.mBody = json["body"];
QJson::QObjectHelper::qvariant2qobject(variant,np);
if (np->version() > CURRENT_PACKAGE_VERSION) {
qDebug() << "Warning: package version " << np->version() << " greater than supported version " << CURRENT_PACKAGE_VERSION;
}
}
void NetworkPackage::createIdentityPackage(NetworkPackage* np)
......
......@@ -25,7 +25,6 @@
#include <QApplication>
ClipboardPackageInterface::ClipboardPackageInterface() {
qDebug() << "ClipboardPackageInterface";
clipboard = QApplication::clipboard();
ignore_next_clipboard_change = false;
connect(clipboard,SIGNAL(changed(QClipboard::Mode)),this,SLOT(clipboardChanged()));
......@@ -37,7 +36,7 @@ void ClipboardPackageInterface::clipboardChanged()
ignore_next_clipboard_change = false;
return;
}
qDebug() << "ClipboardChanged";
//qDebug() << "ClipboardChanged";
NetworkPackage np(PACKAGE_TYPE_CLIPBOARD);
np.set("content",clipboard->text());
emit sendPackage(np);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment