Skip to content

Commit

Permalink
docs: add recommendation on destroying direct D-Bus connections
Browse files Browse the repository at this point in the history
  • Loading branch information
sangelovic committed Oct 10, 2023
1 parent 0ad2553 commit aac7e59
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/using-sdbus-c++.md
Original file line number Diff line number Diff line change
Expand Up @@ -1664,11 +1664,14 @@ int main(int argc, char *argv[])
auto concatenatedString = concatenatorProxy.concatenate(numbers, separator);
assert(concatenatedString == "1:2:3");
// Explicitly stop working on socket fd's to avoid "Connection reset by peer" errors
clientConnection->leaveEventLoop();
serverConnection->leaveEventLoop();
}
```
> **_Note_:** The example above explicitly stops the event loops on both sides, before the connection objects are destroyed. This avoids potential `Connection reset by peer` errors caused when one side closes its socket while the other side is still working on the counterpart socket. This is a recommended workflow for closing direct D-Bus connections.
Conclusion
----------
Expand Down

0 comments on commit aac7e59

Please sign in to comment.