Access the session map with a write lock for use by other session submodules.
(
&self,
addr: &SocketAddr,
f: impl FnOnce(&mut PgSession) -> R,
)
| 187 | |
| 188 | /// Access the session map with a write lock for use by other session submodules. |
| 189 | pub(super) fn write_session<R>( |
| 190 | &self, |
| 191 | addr: &SocketAddr, |
| 192 | f: impl FnOnce(&mut PgSession) -> R, |
| 193 | ) -> Option<R> { |
| 194 | let mut sessions = self.sessions.write().unwrap_or_else(|p| p.into_inner()); |
| 195 | sessions.get_mut(addr).map(f) |
| 196 | } |
| 197 | } |
no test coverage detected