删除无用的代码
This commit is contained in:
parent
4c1e09cbbb
commit
5f36c28040
@ -1,33 +0,0 @@
|
|||||||
//
|
|
||||||
// SDLAsyncTimerStream.swift
|
|
||||||
// Tun
|
|
||||||
//
|
|
||||||
// Created by 安礼成 on 2026/2/3.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
class SDLAsyncTimerStream {
|
|
||||||
let timer: DispatchSourceTimer
|
|
||||||
let stream: AsyncStream<Void>
|
|
||||||
private let cont: AsyncStream<Void>.Continuation
|
|
||||||
|
|
||||||
init() {
|
|
||||||
self.timer = DispatchSource.makeTimerSource(queue: .global())
|
|
||||||
(stream, cont) = AsyncStream.makeStream(of: Void.self)
|
|
||||||
}
|
|
||||||
|
|
||||||
func start(interval: DispatchTimeInterval) {
|
|
||||||
timer.schedule(deadline: .now(), repeating: interval)
|
|
||||||
timer.setEventHandler { [weak self] in
|
|
||||||
self?.cont.yield()
|
|
||||||
}
|
|
||||||
timer.resume()
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit {
|
|
||||||
self.cont.finish()
|
|
||||||
self.timer.cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -8,6 +8,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
final class PacketInboundProcessor {
|
final class PacketInboundProcessor {
|
||||||
|
|
||||||
enum ProcessingAction {
|
enum ProcessingAction {
|
||||||
case sendARPReply(dstMac: Data, data: Data)
|
case sendARPReply(dstMac: Data, data: Data)
|
||||||
case appendARP(ip: UInt32, mac: Data)
|
case appendARP(ip: UInt32, mac: Data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user