File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Sources/SwiftOCA/OCP.1/Backend Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -166,13 +166,6 @@ public class Ocp1FlyingSocksConnection: Ocp1Connection {
166166 }
167167 }
168168
169- override public func write( _ data: Data ) async throws -> Int {
170- try await withMappedError { socket in
171- try await socket. write ( data)
172- return data. count
173- }
174- }
175-
176169 var socketType : SocketType {
177170 fatalError ( " socketType must be implemented by a concrete subclass of Ocp1FlyingSocksConnection " )
178171 }
@@ -195,6 +188,13 @@ public final class Ocp1FlyingSocksStreamConnection: Ocp1FlyingSocksConnection {
195188 }
196189 }
197190
191+ override public func write( _ data: Data ) async throws -> Int {
192+ try await withMappedError { socket in
193+ try await socket. write ( data)
194+ return data. count
195+ }
196+ }
197+
198198 override func setSocketOptions( _ socket: Socket ) throws {
199199 if deviceAddress. family == AF_INET {
200200 try socket. setValue ( true , for: BoolSocketOption ( name: TCP_NODELAY) , level: CInt ( IPPROTO_TCP) )
@@ -220,6 +220,13 @@ public final class Ocp1FlyingSocksDatagramConnection: Ocp1FlyingSocksConnection
220220 try await Data ( socket. read ( atMost: Ocp1MaximumDatagramPduSize) )
221221 }
222222 }
223+
224+ override public func write( _ data: Data ) async throws -> Int {
225+ try await withMappedError { socket in
226+ try await socket. send ( data, to: deviceAddress)
227+ return data. count
228+ }
229+ }
223230}
224231
225232func deviceAddressToString( _ deviceAddress: any SocketAddress ) -> String {
You can’t perform that action at this time.
0 commit comments