Skip to content

Commit

Permalink
listen for socket updates until we have all the required data
Browse files Browse the repository at this point in the history
  • Loading branch information
davidscheutz committed Nov 3, 2022
1 parent 43acc26 commit 2e57331
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ public class SocketController {
Logger().debug("Socket controller has new data available")
guard let new = notification.object as? FileHandle else { return }
Logger().debug("Socket controller received new file handle")
if((handler?(new, new)) == true) {
let didHandle = handler?(new, new) == true

if didHandle {
Logger().debug("Socket controller handled data, wait for more data")
new.waitForDataInBackgroundAndNotify()
} else {
Logger().debug("Socket controller called with empty data, socked closed")
Logger().debug("Socket controller called with not enough empty data, waiting for more data...")
}
}

Expand Down

0 comments on commit 2e57331

Please sign in to comment.