func process()

in glean-core/ios/Glean/Net/HttpPingUploader.swift [176:199]


    func process() {
        if !stateRunAllowed.value {
            self.logger.info("Not allowed to continue running. Bye!")
        }

        while true {
            // Limits are enforced by glean-core to avoid an infinite loop here.
            // Whenever a limit is reached, this binding will receive `.done` and step out.
            switch gleanGetUploadTask() {
            case let .upload(request):
                var body = Data(capacity: request.body.count)
                body.append(contentsOf: request.body)
                self.upload(request: request) { result in
                    if gleanProcessPingUploadResponse(request.documentId, result) == .end {
                        return
                    }
                }
            case .wait(let time):
                sleep(UInt32(time) / 1000)
            case .done:
                return
            }
        }
    }