This commit is contained in:
Norman Maurer committed 2017-04-28 14:57:57 +02:00
1 parent 3048360f19
commit ffb10a59cf
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -102,7 +102,7 @@ public class BaseSocket : Selectable {
let res = Darwin.close(self.descriptor)
#endif
guard res >= 0 else {
throw IOError(errno: errno, reason: "shutdown(...) failed")
throw IOError(errno: errno, reason: "close(...) failed")
}
self.open = false
}
+2
View File
@@ -103,6 +103,8 @@ do {
// Accept new connections until there are no more in the backlog
while let accepted = try socket.accept() {
try accepted.setNonBlocking()
try accepted.setOption(level: SOL_SOCKET, name: SO_REUSEADDR, value: 1)
// Allocate an 8kb buffer for reading and writing and register the socket with the selector
let buffer = Buffer(capacity: 8 * 1024)