Skip to content

Commit

Permalink
Major Bug fixes was done, it is as follows.
Browse files Browse the repository at this point in the history
    * Fixed stalled updater after error in the updater due
      to network issues.

    * Fixed huge memory leaks, (i.e) Allocation of Block Replies
      were never freed by the program and were given the work to
      Qt and the operating system. Now we explicitly and safely delete
      all memory we allocate, Still there is a minor leak which needs
      to be fixed on the next release.

    * Fixed stalled updater on close of the progress dialog on a
      active update. (i.e) When the updater dialog was simply closed
      using the window buttons, The updater does not cancel itself.
      Instead it would continue the update in background.

    * Better handling of the redirected target file url. In the past
      errors were caused due to expired target file urls. THis is fixed
      now by resolving the redirects at the block range downloader and
      not the control file parser.

    * Other small fixes and added type safety when using QObject::sender()
  • Loading branch information
antony-jr committed Oct 20, 2019
1 parent 3b38d21 commit 616234b
Show file tree
Hide file tree
Showing 37 changed files with 1,217 additions and 1,046 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

option(LG "LOGGING_DISABLED" OFF)
option(NG "NO_GUI" OFF)

Expand Down Expand Up @@ -68,6 +69,7 @@ list(APPEND toinstall

if(LOGGING_DISABLED)
message("-- [*] IMPORTANT: Logging will be disabled for this build.")
add_definitions(-DLOGGING_DISABLED)
endif()

if(NO_GUI)
Expand All @@ -83,7 +85,6 @@ else()
endif()

add_library(AppImageUpdaterBridge ${source})
target_compile_definitions(AppImageUpdaterBridge PUBLIC LOGGING_DISABLED=LG)
target_link_libraries(AppImageUpdaterBridge PUBLIC Qt5::Core Qt5::Network)
target_include_directories(AppImageUpdaterBridge INTERFACE "$<BUILD_INTERFACE:. include>")
target_include_directories(AppImageUpdaterBridge INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/AppImageUpdaterBridge>" )
Expand Down
70 changes: 35 additions & 35 deletions examples/ProxyUpdate/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@
#include <QDebug>
#include <AppImageUpdaterBridge>

int main(int ac , char **av){
if(ac == 1){
qInfo() << "Usage: " << av[0] << "[APPIMAGE PATH]";
return 0;
}
using AppImageUpdaterBridge::AppImageDeltaRevisioner;
using AppImageUpdaterBridge::errorCodeToDescriptionString;
QCoreApplication app(ac , av);
QString AppImagePath(av[1]);
int main(int ac, char **av) {
if(ac == 1) {
qInfo() << "Usage: " << av[0] << "[APPIMAGE PATH]";
return 0;
}
using AppImageUpdaterBridge::AppImageDeltaRevisioner;
using AppImageUpdaterBridge::errorCodeToDescriptionString;
QCoreApplication app(ac, av);
QString AppImagePath(av[1]);

/* set proxy settings */
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName("127.0.0.1");
proxy.setPort(9050);

AppImageDeltaRevisioner Revisioner(AppImagePath);
/* set proxy settings */
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName("127.0.0.1");
proxy.setPort(9050);

QObject::connect(&Revisioner , &AppImageDeltaRevisioner::error ,
[&](short code){
qCritical() << "Could not continue the update because , "
<< errorCodeToDescriptionString(code);
app.quit();
return;
});
AppImageDeltaRevisioner Revisioner(AppImagePath);

QObject::connect(&Revisioner , &AppImageDeltaRevisioner::finished ,
[&](QJsonObject newVersion , QString oldVersionPath){
(void)newVersion;
(void)oldVersionPath;
qInfo() << "Update Completed!";
app.quit();
return;
});
Revisioner.setShowLog(true);
Revisioner.setProxy(proxy);
Revisioner.start();
return app.exec();
QObject::connect(&Revisioner, &AppImageDeltaRevisioner::error,
[&](short code) {
qCritical() << "Could not continue the update because , "
<< errorCodeToDescriptionString(code);
app.quit();
return;
});

QObject::connect(&Revisioner, &AppImageDeltaRevisioner::finished,
[&](QJsonObject newVersion, QString oldVersionPath) {
(void)newVersion;
(void)oldVersionPath;
qInfo() << "Update Completed!";
app.quit();
return;
});
Revisioner.setShowLog(true);
Revisioner.setProxy(proxy);
Revisioner.start();
return app.exec();
}

2 changes: 1 addition & 1 deletion examples/SimpleUpdate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# find installed library
find_package(AppImageUpdaterBridge)

add_executable(SimpleUpdate main.cc TextProgressBar.cc)
add_executable(SimpleUpdate main.cc cutelog.c)

target_link_libraries(SimpleUpdate PRIVATE AppImageUpdaterBridge)
4 changes: 2 additions & 2 deletions examples/SimpleUpdate/SimpleUpdate.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ TEMPLATE = app
TARGET = SimpleUpdate

SOURCES += main.cc \
TextProgressBar.cc
HEADERS += TextProgressBar.hpp
cutelog.c
HEADERS += cutelog.h
58 changes: 0 additions & 58 deletions examples/SimpleUpdate/TextProgressBar.cc

This file was deleted.

22 changes: 0 additions & 22 deletions examples/SimpleUpdate/TextProgressBar.hpp

This file was deleted.

Loading

0 comments on commit 616234b

Please sign in to comment.