mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-14 17:02:43 +08:00
Cleanup
This commit is contained in:
parent
f433f5e904
commit
80eeb955e3
@ -36,7 +36,7 @@ public class SOCKSClientHandler: ChannelDuplexHandler {
|
||||
switch targetAddress {
|
||||
case .address(.unixDomainSocket):
|
||||
preconditionFailure("UNIX domain sockets are not supported.")
|
||||
case .domain(_, port: _), .address(.v4), .address(.v6):
|
||||
case .domain, .address(.v4), .address(.v6):
|
||||
break
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class SOCKSClientHandler: ChannelDuplexHandler {
|
||||
context.write(data, promise: nil)
|
||||
}
|
||||
|
||||
public func writeBufferedData(context: ChannelHandlerContext) {
|
||||
func writeBufferedData(context: ChannelHandlerContext) {
|
||||
while let (data, promise) = self.bufferedWrites.first {
|
||||
context.write(data, promise: promise)
|
||||
self.bufferedWrites.removeFirst()
|
||||
|
@ -92,7 +92,7 @@ public enum AddressType: Hashable {
|
||||
case .address(.unixDomainSocket):
|
||||
fatalError("Unsupported")
|
||||
case .domain(let domain, port: _):
|
||||
return domain.count + 1
|
||||
return domain.utf8.count + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,7 @@ extension ByteBuffer {
|
||||
fatalError("UNIX domain sockets are not supported")
|
||||
case .domain(let domain, port: let port):
|
||||
return self.writeInteger(UInt8(3))
|
||||
+ self.writeInteger(UInt8(domain.count))
|
||||
+ self.writeInteger(UInt8(domain.utf8.count))
|
||||
+ self.writeString(domain)
|
||||
+ self.writeInteger(port)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user