Network is not working when over 50MB size file upload smb using NEFilterDataProvider in macOS
The event received through NEFilterDataProvider is returned immediately without doing any other work.
override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let auditToken = socketFlow.sourceAppAuditToken,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
return .filterDataVerdict(withFilterInbound: true, peekInboundBytes: Int.max, filterOutbound: true, peekOutboundBytes: Int.max)
}
override func handleInboundData(from flow: NEFilterFlow, readBytesStartOffset offset: Int, readBytes: Data) -> NEFilterDataVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let auditToken = socketFlow.sourceAppAuditToken,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
return NEFilterDataVerdict(passBytes: readBytes.count, peekBytes: Int.max)
}
override func handleOutboundData(from flow: NEFilterFlow, readBytesStartOffset offset: Int, readBytes: Data) -> NEFilterDataVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let auditToken = socketFlow.sourceAppAuditToken,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
return NEFilterDataVerdict(passBytes: readBytes.count, peekBytes: Int.max)
}
override func handleInboundDataComplete(for flow: NEFilterFlow) -> NEFilterDataVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let auditToken = socketFlow.sourceAppAuditToken,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
return .allow()
}
override func handleOutboundDataComplete(for flow: NEFilterFlow) -> NEFilterDataVerdict {
guard let socketFlow = flow as? NEFilterSocketFlow,
let auditToken = socketFlow.sourceAppAuditToken,
let remoteEndpoint = socketFlow.remoteEndpoint as? NWHostEndpoint,
let localEndpoint = socketFlow.localEndpoint as? NWHostEndpoint else {
return .allow()
}
return .allow()
}
how can i fix it?