Skip to content

Commit 42942b5

Browse files
Merge pull request #216 from jalakoo/stable
Added HttpServerIODelegate protocol
2 parents e4ee35f + 64304a7 commit 42942b5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Sources/HttpServerIO.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
import Foundation
99
import Dispatch
1010

11+
protocol HttpServerIODelegate {
12+
func socketConnectionReceived(_ socket: Socket)
13+
}
14+
1115
public class HttpServerIO {
16+
17+
public weak var delegate : HttpServerIODelegate?
1218

1319
private var socket = Socket(socketFileDescriptor: -1)
1420
private var sockets = Set<Socket>()
@@ -115,6 +121,7 @@ public class HttpServerIO {
115121
break
116122
}
117123
if let session = response.socketSession() {
124+
delegate?.socketConnectionReceived(socket)
118125
session(socket)
119126
break
120127
}

0 commit comments

Comments
 (0)