Worked on fixing the main libQuic crashes

• Revert logic to stop voice messages from playing when their associated message disappears
• Updated the libSession build script to pass through the build type (so we get debug libSession builds when doing debug builds)
• Fixed a couple of issues in libSession around recovering network connectivity
pull/976/head
Morgan Pretty 1 month ago
parent b58a3f23cd
commit d1a4683bc3

@ -1 +1 @@
Subproject commit b66e54b25805a3edbf5c09fafa2c486b18766383
Subproject commit d0b03ecf7d17e365edb077d888e926c88ef5d593

@ -192,9 +192,11 @@ fi
rm -rf "${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log"
submodule_check=ON
build_type="Release"
if [ "$CONFIGURATION" == "Debug" ]; then
submodule_check=OFF
build_type="Debug"
fi
echo "CMake build logs: ${TARGET_BUILD_DIR}/libSessionUtil/libsession_util_output.log"
@ -219,7 +221,8 @@ for i in "${!TARGET_ARCHS[@]}"; do
-DBUILD_TESTS=OFF \
-DBUILD_STATIC_DEPS=ON \
-DENABLE_VISIBILITY=ON \
-DSUBMODULE_CHECK=$submodule_check
-DSUBMODULE_CHECK=$submodule_check \
-DCMAKE_BUILD_TYPE=$build_type
# Capture the exit status of the ./utils/static-bundle.sh command
EXIT_STATUS=$?

@ -197,8 +197,9 @@ public final class SessionCallManager: NSObject, CallManagerProtocol {
// Stop all jobs except for message sending and when completed suspend the database
JobRunner.stopAndClearPendingJobs(exceptForVariant: .messageSend, using: dependencies) {
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
}
}
}

@ -442,16 +442,6 @@ public class ConversationViewModel: OWSAudioPlayerDelegate {
.filter { !$0.cellType.isPostProcessed } // Remove headers and other
.sorted { lhs, rhs -> Bool in lhs.timestampMs < rhs.timestampMs }
// If we are currently playing a voice message we should make sure it hasn't been deleted and, if
// it has, we should stop playing the audio (this is mostly to catch the case where a message is
// deleted due to a disappearing messages setting)
if
let audioPlayingInteractionId: Int64 = currentPlayingInteraction.wrappedValue,
!sortedData.contains(where: { $0.id == audioPlayingInteractionId })
{
self.stopAudio()
}
// We load messages from newest to oldest so having a pageOffset larger than zero means
// there are newer pages to load
return [

@ -211,8 +211,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// Stop all jobs except for message sending and when completed suspend the database
JobRunner.stopAndClearPendingJobs(exceptForVariant: .messageSend, using: dependencies) {
if !self.hasCallOngoing() {
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.info("[AppDelegate] completed network and database shutdowns.")
Log.flush()
}
}
}
@ -292,14 +294,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
guard BackgroundPoller.isValid else { return }
Log.info("Background poll failed due to manual timeout")
BackgroundPoller.isValid = false
if Singleton.hasAppContext && Singleton.appContext.isInBackground {
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
}
Log.info("Background poll failed due to manual timeout")
completionHandler(.failed)
}
@ -322,8 +325,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
BackgroundPoller.isValid = false
if Singleton.hasAppContext && Singleton.appContext.isInBackground {
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
}
cancelTimer.invalidate()

@ -112,7 +112,6 @@ public struct SessionApp {
// MARK: - Functions
public static func resetAppData(onReset: (() -> ())? = nil) {
Log.flush()
LibSession.clearMemoryState()
LibSession.clearSnodeCache()
LibSession.closeNetworkConnections()
@ -120,6 +119,7 @@ public struct SessionApp {
ProfileManager.resetProfileStorage()
Attachment.resetAttachmentStorage()
AppEnvironment.shared.notificationPresenter.clearAllNotifications()
Log.flush()
onReset?()
exit(0)

@ -343,15 +343,15 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
}) == false
else { return }
Log.info("Complete silently.")
Log.flush()
let silentContent: UNMutableNotificationContent = UNMutableNotificationContent()
silentContent.badge = Storage.shared
.read { db in try Interaction.fetchUnreadCount(db) }
.map { NSNumber(value: $0) }
.defaulting(to: NSNumber(value: 0))
Storage.suspendDatabaseAccess()
Log.info("Complete silently.")
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
self.contentHandler!(silentContent)
}
@ -416,9 +416,9 @@ public final class NotificationServiceExtension: UNNotificationServiceExtension
private func handleFailure(for content: UNMutableNotificationContent, error: NotificationError) {
Log.error("Show generic failure message due to error: \(error).")
Log.flush()
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
content.title = "Session"
content.body = "APN_Message".localized()

@ -100,9 +100,9 @@ final class ThreadPickerVC: UIViewController, UITableViewDataSource, UITableView
// When the thread picker disappears it means the user has left the screen (this will be called
// whether the user has sent the message or cancelled sending)
Log.flush()
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
}
@objc func applicationDidBecomeActive(_ notification: Notification) {
@ -314,9 +314,9 @@ final class ThreadPickerVC: UIViewController, UITableViewDataSource, UITableView
.receive(on: DispatchQueue.main)
.sinkUntilComplete(
receiveCompletion: { [weak self] result in
Log.flush()
Storage.suspendDatabaseAccess()
LibSession.closeNetworkConnections()
Storage.suspendDatabaseAccess()
Log.flush()
activityIndicator.dismiss { }
switch result {

Loading…
Cancel
Save