[Libreoffice-commits] online.git: net/FakeSocket.cpp net/FakeSocket.hpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 15 22:11:53 UTC 2018


 net/FakeSocket.cpp |   33 +++++++++++++++++++++++++++++++++
 net/FakeSocket.hpp |    2 ++
 2 files changed, 35 insertions(+)

New commits:
commit cab2f9b6bb1d1bcc5644c61b88c6a1fff85d71bb
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Oct 15 22:41:38 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Oct 16 01:11:20 2018 +0300

    Add fakeSocketDumpState()

diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index 95dc4ef8f..580fd2af3 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -653,4 +653,37 @@ int fakeSocketClose(int fd)
     return 0;
 }
 
+void fakeSocketDumpState()
+{
+    std::vector<FakeSocketPair>& fds = getFds();
+    std::unique_lock<std::mutex> lock(theMutex);
+
+    loggingBuffer << "FakeSocket open sockets:";
+    for (int i = 0; i < fds.size(); i++)
+    {
+        if (fds[i].fd[0] != -1)
+        {
+            assert(fds[i].fd[0] == i*2);
+            loggingBuffer << "\n  #" << fds[i].fd[0];
+            if (fds[i].fd[1] != -1)
+            {
+                assert(fds[i].fd[1] == i*2+1);
+                assert(!fds[i].listening);
+                loggingBuffer << " <=> #" << fds[i].fd[1];
+            }
+            else if (fds[i].listening)
+            {
+                loggingBuffer << " listening";
+            }
+        }
+        else if (fds[i].fd[1] != -1)
+        {
+            assert(fds[i].fd[1] == i*2+1);
+            assert(!fds[i].listening);
+            loggingBuffer << "\n  #" << fds[i].fd[1];
+        }
+    }
+    loggingBuffer << flush();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/net/FakeSocket.hpp b/net/FakeSocket.hpp
index bf9e94d61..c29195ddb 100644
--- a/net/FakeSocket.hpp
+++ b/net/FakeSocket.hpp
@@ -44,6 +44,8 @@ int fakeSocketShutdown(int fd);
 
 int fakeSocketClose(int fd);
 
+void fakeSocketDumpState();
+
 #endif // MOBILEAPP
 
 #endif // INCLUDED_FAKESOCKET_H


More information about the Libreoffice-commits mailing list