Skip to content

Commit

Permalink
Fix compile issue on Swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
enums committed Jan 1, 2022
1 parent 7df77c6 commit dc974b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Sources/Heze/Socket/HezeSocketHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ open class HezeSocketHandler: HezeHandler, WebSocketSessionHandler {
return nil
}

open class func makeInstance(context: HezeContext) -> HezeSocketHandler? {
let instance = Self.init() as HezeSocketHandler
open class func create(context: HezeContext = .main) -> HezeSocketHandler? {
let instance = self.init()
instance.bindContext(context)
return instance
}
Expand All @@ -38,9 +38,9 @@ open class HezeSocketHandler: HezeHandler, WebSocketSessionHandler {
guard protocols.contains(socketProtocol) else {
return nil
}
return Self.makeInstance(context: self.context)
return type(of: self).create(context: self.context)
} else {
return Self.makeInstance(context: self.context)
return type(of: self).create(context: self.context)
}
}).handleRequest(request: req, response: res)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/HezeDemo/Socket/RepeatSocketClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class RepeatSocketClient: HezeSocketClient {
return bytes
}

override class func makeInstance(context: HezeContext) -> HezeSocketHandler? {
override class func create(context: HezeContext) -> HezeSocketHandler? {
if RepeatSocketClientStorage == nil {
RepeatSocketClientStorage = super.makeInstance(context: context)
RepeatSocketClientStorage = super.create(context: context)
}
return RepeatSocketClientStorage
}
Expand Down

0 comments on commit dc974b9

Please sign in to comment.