Use Int for port to make API more consistent

Motivation:

In ClientBootstrap we use Int to represent the port but in ServerBootstrap we use Int32. As swift usually always use Int we should just use Int everywhere to represent the port.

Modifications:

Change Int32 to Int for port

Result:

More consistent API
This commit is contained in:
Norman Maurer committed 2018-02-12 13:39:01 +01:00
1 parent 18a8467dfe
commit aa9728b852
6 files changed
+11 -11

No files matched your search

+3 -3
View File
@@ -357,17 +357,17 @@ let arg2 = arguments.dropFirst().dropFirst().first
let arg3 = arguments.dropFirst().dropFirst().dropFirst().first
let defaultHost = "::1"
let defaultPort: Int32 = 8888
let defaultPort = 8888
let defaultHtdocs = "/dev/null/"
enum BindTo {
case ip(host: String, port: Int32)
case ip(host: String, port: Int)
case unixDomainSocket(path: String)
}
let htdocs: String
let bindTarget: BindTo
switch (arg1, arg1.flatMap { Int32($0) }, arg2, arg2.flatMap { Int32($0) }, arg3) {
switch (arg1, arg1.flatMap { Int($0) }, arg2, arg2.flatMap { Int($0) }, arg3) {
case (.some(let h), _ , _, .some(let p), let maybeHtdocs):
/* second arg an integer --> host port [htdocs] */
bindTarget = .ip(host: h, port: p)