# server.Server.owns_control_client

- **Module:** server.Server
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/server.rs#L447
- **Page:** https://libtmux.org/en/rs/latest/reference/server-server-owns_control_client/

```
server.Server.owns_control_client(self, pid: u32) -> bool
```

Report whether this process itself opened the control client with this pid, and it is still running.

[`crate::Client::is_own`] is the usual form, and reads better: ask a handle
from [`Self::clients`] rather than doing pid arithmetic. This one is
for a caller that already has a pid and no handle -- reading
`list-clients` itself to get sessions and pids in one command, which a
per-client lookup would turn into one command each.

[`crate::Pane::stream_output`], [`crate::Client::pid`] and friends can
all open or report a control-mode connection; tmux counts any of them
as an attached client the same as a human's terminal. A caller telling
its own observation apart from an attached human reads every
[`crate::Client::pid`] it cares about through this rather than
tracking one connection it happened to keep, because more than one may
be open at once.

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();

// Nothing has opened a control client yet.
assert!(!server.owns_control_client(std::process::id()));

guard.shutdown().await?;
```
