             return try Response(pathToFile: path)
         })
     }
+}
+
+// MARK: - RunStatus
+public extension Server {
+    public enum RunStatus {
+        case willRun
+        case running
+        case paused
+        case pausing(now: Bool, closure: ()->())
+        case stopped
+        case stopping(now: Bool)
+    }
+
+    var isPaused: Bool {
+        guard case .stopped = runStatus else {
+            return false
+        }
+        return true
+    }
+
+    var willRun: Bool {
+        guard case .willRun = runStatus else {
+            return false
+        }
+        return true
+    }
+
+    var isStopped: Bool {
+        guard case .stopped = runStatus else {
+            return false
+        }
+        return true
+    }
+
+    var isRunning: Bool {
+        guard case .running = runStatus else {
+            return false
+        }
+        return true
+    }
+}
+
+// MARK: - Sending
+private extension Server {
+
 
     private func sendPartial(socket: Socket, range: (bottom: UInt, top: UInt), response: Response) {
         let bodyBytes = response.rawBody


/// Server class
open class Server: Router {
    private let port: UInt16
//    let bufferSize = 20
    var listenSocket: Socket? = nil
    var connected = [Int32: Socket]()
    var acceptNewConnection = true
    let serverRoot: Path
    /// url
    public let url: String

        } catch let error {
            log.error("error with client: \(error)")
        }
    }

    private func handle(request: Request) -> Response {
