 
     private func checkWrite() {
         dispatch_async(queue) {
-            self.lastActive = NSDate()
+            self.updateActivityTimer()
 
             guard !self.writing else {
                 return

    init(host: String, port: Int) {
        session = RawSocketFactory.TunnelProvider.createUDPSessionToEndpoint(NWHostEndpoint(hostname: host, port: "\(port)"), fromEndpoint: nil)
        session.setReadHandler({ [ unowned self ] dataArray, error in
            self.lastActive = NSDate()

            guard error == nil else {
                DDLogError("Error when reading from remote server. \(error)")

        }
    }

    private func updateActivityTimer() {
        lastActive = NSDate()
    }
}
