Skip to content

Commit

Permalink
Update include/mumble/Connection.hpp
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Adam <[email protected]>
  • Loading branch information
botanegg and Krzmbrzl committed Mar 12, 2023
1 parent 82b660b commit a357013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/mumble/Connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MUMBLE_EXPORT Connection : NonCopyable {
const BufViewConst data, const bool wait = true, const std::function< bool() > halt = []() { return false; });

private:
[[nodiscard]] std::lock_guard<std::recursive_mutex> make_lock() {
[[nodiscard]] std::lock_guard<std::recursive_mutex> lock() {
return std::lock_guard<std::recursive_mutex>(m_mutex);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Connection::operator bool() const {
}

Code Connection::operator()(const Feedback &feedback, const std::function< bool() > halt) {
auto guard = make_lock();
auto guard = lock();

if (!m_p->m_monitorIn.add(m_p->m_handle, true, false) || !m_p->m_monitorOut.add(m_p->m_handle, false, true)) {
return Code::Failure;
Expand Down Expand Up @@ -89,7 +89,7 @@ Cert::Chain Connection::peerCert() const {
}

bool Connection::setCert(const Cert::Chain &cert, const Key &key) {
auto guard = make_lock();
auto guard = lock();

return m_p->setCert(cert, key);
}
Expand All @@ -100,7 +100,7 @@ Code Connection::process(const bool wait, const std::function< bool() > halt) {
using Pack = tcp::Pack;
using Type = Message::Type;

auto guard = make_lock();
auto guard = lock();
do {
NetHeader header;
auto code = m_p->read({ reinterpret_cast< std::byte * >(&header), sizeof(header) }, wait, halt);
Expand Down Expand Up @@ -137,7 +137,7 @@ Code Connection::process(const bool wait, const std::function< bool() > halt) {
}

Code Connection::write(const BufViewConst data, const bool wait, const std::function< bool() > halt) {
auto guard = make_lock();
auto guard = lock();

return m_p->write(data, wait, halt);
}
Expand Down

0 comments on commit a357013

Please sign in to comment.