Explorar o código

switching ping to every 10 seconds

logicp %!s(int64=5) %!d(string=hai) anos
pai
achega
5352f03ed7
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      src/client.cpp
  2. 1 1
      src/mainwindow.cpp

+ 1 - 1
src/client.cpp

@@ -85,7 +85,6 @@ void Client::handleMessages() {
             QVector<QString> args = getArgs(data_string.c_str());
             QVector<QString> args = getArgs(data_string.c_str());
             emit Client::messageReceived(EVENT_UPDATE_TYPE, event, args); // Update UI (event)
             emit Client::messageReceived(EVENT_UPDATE_TYPE, event, args); // Update UI (event)
             if (isUploadCompleteEvent(event.toUtf8().constData())) { // Upload complete
             if (isUploadCompleteEvent(event.toUtf8().constData())) { // Upload complete
-              file_was_sent = true;
               if (!args.isEmpty()) {
               if (!args.isEmpty()) {
                 sent_files.at(sent_files.size() - 1).timestamp =
                 sent_files.at(sent_files.size() - 1).timestamp =
                     std::stoi(args.at(0).toUtf8().constData());
                     std::stoi(args.at(0).toUtf8().constData());
@@ -331,6 +330,7 @@ void Client::sendPackets(uint8_t* data, int size) {
         if (is_last_packet) {
         if (is_last_packet) {
             // cleanup
             // cleanup
             qDebug() << "Last packet of file sent";
             qDebug() << "Last packet of file sent";
+            file_was_sent = true;
         }
         }
     }
     }
 }
 }

+ 1 - 1
src/mainwindow.cpp

@@ -183,7 +183,7 @@ void MainWindow::connectClient() {
 
 
   QTimer* timer = new QTimer(this);
   QTimer* timer = new QTimer(this);
   connect(timer, &QTimer::timeout, q_client, &Client::ping);
   connect(timer, &QTimer::timeout, q_client, &Client::ping);
-  timer->start(30000);
+  timer->start(10000);
 }
 }
 
 
 void MainWindow::handleKey() {
 void MainWindow::handleKey() {