<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/TorControlClient/shutdown()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor0A13ControlClientC8shutdownyyYaKF"
  },
  "title" : "shutdown()"
}
-->

# shutdown()

Ask Tor to exit cleanly (`SIGNAL SHUTDOWN`).

```
func shutdown() async throws
```

## Discussion

Tor finishes in-flight requests, tears down circuits, and
exits. Called by [`stop()`](/documentation/Tor/TorClient/stop()) before its 10-second
join window. Callers should not invoke this directly unless
they own the Tor lifecycle outside swift-tor (e.g. driving an
external `tor` daemon).

> Throws: ``doc://Tor/documentation/Tor/TorError/controlProtocolError(code:message:)`` on
> rejection.

> Important: Tor’s `ShutdownWaitLength` (default 30 seconds)
> controls the grace period for in-flight requests; swift-tor
> shortens the wait to 10 s at the ``doc://Tor/documentation/Tor/TorClient/stop()``
> level so shutdown is bounded for UIs.