File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Sources/SwiftOCA/OCP.1/Backend Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -50,20 +50,19 @@ fileprivate extension SocketError {
5050
5151private extension Data {
5252 var socketAddress : any SocketAddress {
53- try ! withUnsafeBytes { unbound -> ( any SocketAddress ) in
54- try unbound
53+ withUnsafeBytes { unbound -> ( any SocketAddress ) in
54+ unbound
5555 . withMemoryRebound (
56- to: sockaddr_storage
57- . self
58- ) { storage -> ( any SocketAddress ) in
59- let ss = storage. baseAddress!. pointee
60- switch ss. ss_family {
56+ to: sockaddr. self
57+ ) { addr -> ( any SocketAddress ) in
58+ let sa = addr. baseAddress!
59+ switch sa. pointee. sa_family {
6160 case sa_family_t ( AF_INET) :
62- return try sockaddr_in. make ( from : ss )
61+ return sa . withMemoryRebound ( to : sockaddr_in. self , capacity : 1 ) { $0 . pointee }
6362 case sa_family_t ( AF_INET6) :
64- return try sockaddr_in6. make ( from : ss )
63+ return sa . withMemoryRebound ( to : sockaddr_in6. self , capacity : 1 ) { $0 . pointee }
6564 case sa_family_t ( AF_LOCAL) :
66- return try sockaddr_un. make ( from : ss )
65+ return sa . withMemoryRebound ( to : sockaddr_un. self , capacity : 1 ) { $0 . pointee }
6766 default :
6867 fatalError ( " unsupported address family " )
6968 }
You can’t perform that action at this time.
0 commit comments