Skip to content

Commit 05ffd72

Browse files
committed
Fixed a few issues
• Fixed some duplicate content in Logging • Fixed broken service node batch requests • Fixed a crash which could occur when using the storage publisher functions
1 parent f4f479b commit 05ffd72

File tree

6 files changed

+12
-21
lines changed

6 files changed

+12
-21
lines changed

Scripts/build_libSession_util.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ if [ "${REQUIRES_BUILD}" == 1 ]; then
338338

339339
echo "- Touching timestamp file to signal update to Xcode"
340340
touch "${BUILT_LIB_FINAL_TIMESTAMP_FILE}"
341-
cp "${BUILT_LIB_FINAL_TIMESTAMP_FILE}" "${SPM_TIMESTAMP_FILE}"
342341

343342
echo "- Build complete"
344343
fi

Session.xcodeproj/project.pbxproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@
988988
FDD20C162A09E64A003898FB /* GetExpiriesRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD20C152A09E64A003898FB /* GetExpiriesRequest.swift */; };
989989
FDD20C182A09E7D3003898FB /* GetExpiriesResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD20C172A09E7D3003898FB /* GetExpiriesResponse.swift */; };
990990
FDD20C1A2A0A03AC003898FB /* DeleteInboxResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD20C192A0A03AC003898FB /* DeleteInboxResponse.swift */; };
991+
FDD23ADE2E44501E0057E853 /* RequestCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD23ADD2E44501B0057E853 /* RequestCategory.swift */; };
991992
FDD23ADF2E457CAA0057E853 /* _016_ThemePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD37E9F828A5F14A003AE748 /* _016_ThemePreferences.swift */; };
992993
FDD23AE02E457CD40057E853 /* _004_SNK_InitialSetupMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD17D79F27F40CC800122BE0 /* _004_SNK_InitialSetupMigration.swift */; };
993994
FDD23AE12E457CDE0057E853 /* _005_SNK_SetupStandardJobs.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD6A7A6C2818C61500035AC1 /* _005_SNK_SetupStandardJobs.swift */; };
@@ -1006,7 +1007,6 @@
10061007
FDD23AEE2E459E470057E853 /* _001_SUK_InitialSetupMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD17D7C927F546D900122BE0 /* _001_SUK_InitialSetupMigration.swift */; };
10071008
FDD23AEF2E459EC90057E853 /* _012_AddJobPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDBB25E22988B13800F1508E /* _012_AddJobPriority.swift */; };
10081009
FDD23AF02E459EDD0057E853 /* _020_AddJobUniqueHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945D9C572D6FDBE7003C4C0C /* _020_AddJobUniqueHash.swift */; };
1009-
FDD23ADE2E44501E0057E853 /* RequestCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD23ADD2E44501B0057E853 /* RequestCategory.swift */; };
10101010
FDD2506E283711D600198BDA /* DifferenceKit+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD2506D283711D600198BDA /* DifferenceKit+Utilities.swift */; };
10111011
FDD250722837234B00198BDA /* MediaGalleryNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD250712837234B00198BDA /* MediaGalleryNavigationController.swift */; };
10121012
FDD82C3F2A205D0A00425F05 /* ProcessResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD82C3E2A205D0A00425F05 /* ProcessResult.swift */; };
@@ -4231,18 +4231,10 @@
42314231
isa = PBXGroup;
42324232
children = (
42334233
FD78EA082DDFE45000D55B50 /* Convenience */,
4234-
FD37E9F728A5F143003AE748 /* Migrations */,
42354234
);
42364235
path = Database;
42374236
sourceTree = "<group>";
42384237
};
4239-
FD37E9F728A5F143003AE748 /* Migrations */ = {
4240-
isa = PBXGroup;
4241-
children = (
4242-
);
4243-
path = Migrations;
4244-
sourceTree = "<group>";
4245-
};
42464238
FD37EA1228AB3F60003AE748 /* Database */ = {
42474239
isa = PBXGroup;
42484240
children = (

SessionNetworkingKit/LibSession/LibSession+Networking.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ class LibSessionNetwork: NetworkType {
268268
switch destination {
269269
case .snode(let snode, _):
270270
try LibSessionNetwork.withSnodeRequestParams(request, snode) { paramsPtr in
271-
// var mutableParams = params
272271
session_network_send_request(network, paramsPtr, cCallback, ctx)
273272
}
274273

@@ -990,13 +989,13 @@ public extension LibSession {
990989
var error: [CChar] = [CChar](repeating: 0, count: 256)
991990
var network: UnsafeMutablePointer<network_object_v2>?
992991
var config: session_network_config = session_network_config_default()
992+
config.cache_refresh_using_legacy_endpoint = true
993993

994994
if dependencies[feature: .serviceNetwork] == .testnet {
995995
config.netid = SESSION_NETWORK_TESTNET
996996
config.enforce_subnet_diversity = false // On testnet we can't do this as nodes share IPs
997997
}
998998

999-
1000999
let result: Result<Void, Error> = cCachePath.withUnsafeBufferPointer { cachePtr in
10011000
config.cache_dir = cachePtr.baseAddress
10021001

SessionNetworkingKit/Types/PreparedRequest.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,13 @@ extension Network.PreparedRequest: ErasedPreparedRequest {
417417
}
418418

419419
public func encodeForBatchRequest(to encoder: Encoder) throws {
420+
var container: KeyedEncodingContainer<Network.BatchRequest.Child.CodingKeys> = encoder.container(keyedBy: Network.BatchRequest.Child.CodingKeys.self)
421+
420422
switch batchRequestVariant {
421423
case .unsupported:
422424
Log.critical("Attempted to encode unsupported request type \(endpointName) as a batch subrequest")
423425

424426
case .sogs:
425-
var container: KeyedEncodingContainer<Network.BatchRequest.Child.CodingKeys> = encoder.container(keyedBy: Network.BatchRequest.Child.CodingKeys.self)
426-
427427
// Exclude request signature headers (not used for sub-requests)
428428
let excludedSubRequestHeaders: [HTTPHeader] = excludedSubRequestHeaders
429429
let batchRequestHeaders: [HTTPHeader: String] = headers
@@ -440,9 +440,9 @@ extension Network.PreparedRequest: ErasedPreparedRequest {
440440
try container.encodeIfPresent(bytes, forKey: .bytes)
441441

442442
case .storageServer:
443-
var container: SingleValueEncodingContainer = encoder.singleValueContainer()
443+
try container.encode(endpoint.path, forKey: .method)
444+
try jsonKeyedBodyEncoder?(&container, .params)
444445

445-
try jsonBodyEncoder?(&container)
446446
}
447447
}
448448
}

SessionUtilitiesKit/Database/Storage.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ public protocol IdentifiableTransactionObserver: TransactionObserver {
13191319

13201320
private extension Storage {
13211321
actor PublisherBridge<T> {
1322-
private weak var subject: PassthroughSubject<T, Error>?
1322+
private var subject: PassthroughSubject<T, Error>?
13231323
private var isFinished: Bool = false
13241324

13251325
init(subject: PassthroughSubject<T, Error>) {
@@ -1329,7 +1329,8 @@ private extension Storage {
13291329
func send(result: Result<T, Error>, info: CallInfo) {
13301330
guard !isFinished, let subject = self.subject else { return }
13311331

1332-
isFinished = true
1332+
self.isFinished = true
1333+
self.subject = nil
13331334

13341335
switch result {
13351336
case .success(let value):
@@ -1346,7 +1347,8 @@ private extension Storage {
13461347
func cancel() {
13471348
guard !isFinished else { return }
13481349

1349-
isFinished = true
1350+
self.isFinished = true
1351+
self.subject = nil
13501352
}
13511353
}
13521354
}

SessionUtilitiesKit/General/Logging.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,7 @@ public actor Logger: LoggerType {
730730
}()
731731

732732
/// Clean up the message if needed (replace double periods with single, trim whitespace, truncate pubkeys)
733-
let cleanedMessage: String = logPrefix
734-
.appending(message)
733+
let cleanedMessage: String = message
735734
.replacingOccurrences(of: "...", with: "|||")
736735
.replacingOccurrences(of: "..", with: ".")
737736
.replacingOccurrences(of: "|||", with: "...")

0 commit comments

Comments
 (0)