aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Library/NetSocket
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2025-11-07 12:44:55 -0800
committerDustin Mierau <dustin@mierau.me>2025-11-07 12:44:55 -0800
commita55318fa8d643160900bec3e6b14e7404c63497a (patch)
treeab6a9eca9a368b35e1490becc70f94ebde6ac271 /Hotline/Library/NetSocket
parent786a387d58fc66ae20716a9dee46b74dff8e6894 (diff)
Organize Library folder a bit. Update Tracker add/edit sheet design.
Diffstat (limited to 'Hotline/Library/NetSocket')
-rw-r--r--Hotline/Library/NetSocket/FileProgress.swift2
-rw-r--r--Hotline/Library/NetSocket/NetSocket.swift (renamed from Hotline/Library/NetSocket/NetSocketNew.swift)6
-rw-r--r--Hotline/Library/NetSocket/TransferRateEstimator.swift2
3 files changed, 3 insertions, 7 deletions
diff --git a/Hotline/Library/NetSocket/FileProgress.swift b/Hotline/Library/NetSocket/FileProgress.swift
index 1cc0228..c2306f3 100644
--- a/Hotline/Library/NetSocket/FileProgress.swift
+++ b/Hotline/Library/NetSocket/FileProgress.swift
@@ -1,4 +1,4 @@
-// NetSocketProgress
+// NetSocket FileProgress
// Dustin Mierau • @mierau
// MIT License
diff --git a/Hotline/Library/NetSocket/NetSocketNew.swift b/Hotline/Library/NetSocket/NetSocket.swift
index 12f4271..5c7d185 100644
--- a/Hotline/Library/NetSocket/NetSocketNew.swift
+++ b/Hotline/Library/NetSocket/NetSocket.swift
@@ -1,5 +1,6 @@
// NetSocket.swift
// Dustin Mierau • @mierau
+// MIT License
import Foundation
import Network
@@ -791,10 +792,7 @@ public actor NetSocket {
private func startReceiveLoop() {
@Sendable func loop(_ connection: NWConnection, chunk: Int, owner: NetSocket, connID: String) {
- print("NetSocket[\(connID)]: Calling connection.receive(\(chunk)) to request more data...")
-
connection.receive(minimumIncompleteLength: 1, maximumLength: chunk) { [weak owner] data, _, isComplete, error in
- print("NetSocket[\(connID)]: Receive callback - data: \(data?.count ?? 0) bytes, isComplete: \(isComplete), error: \(String(describing: error))")
Task {
guard let o = owner else {
return
@@ -808,7 +806,6 @@ public actor NetSocket {
await o.append(data, connID: connID)
}
if isComplete {
- print("NetSocket[\(connID)]: EOF from peer.")
await o.handleEOF()
return
}
@@ -950,7 +947,6 @@ public actor NetSocket {
}
private func append(_ data: Data, connID: String) {
- print("NetSocket[\(connID)]: Received \(data.count) bytes from network, buffer now has \(buffer.count - head + data.count) available")
buffer.append(data)
if buffer.count - head > config.maxBufferBytes {
// Hard stop: drop connection rather than OOM'ing.
diff --git a/Hotline/Library/NetSocket/TransferRateEstimator.swift b/Hotline/Library/NetSocket/TransferRateEstimator.swift
index 60647a7..badf87a 100644
--- a/Hotline/Library/NetSocket/TransferRateEstimator.swift
+++ b/Hotline/Library/NetSocket/TransferRateEstimator.swift
@@ -1,4 +1,4 @@
-// TransferRateEstimator
+// NetSocket: TransferRateEstimator
// Dustin Mierau • @mierau
// MIT License