Commit Graph

19 Commits (7183a3d3de67a945224c71900e0d3511359bd7e8)

Author SHA1 Message Date
Michael Meeks 7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Michael Meeks 08d9081280 net: don't try to set TCP_NODELAY on local Unix sockets.
Change-Id: Ic0f720554080a01b7a46abbffda023834016c0ea
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-01 08:06:53 +00:00
Ashod Nakashian 9c39ebad1f wsd: string::empty() is clearer than size() == 0
Change-Id: If2e25d344b5718c35cb9ae7b7519010ee88f0f60
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-03-10 07:45:12 -05:00
Michael Meeks ef09966978 mutex include cleanup.
Change-Id: I63d4184260d204a9d5f7658ad51fbe63dbb3c9e4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-08-31 21:31:31 +01:00
Ashod Nakashian 42a7607489 wsd: avoid static SocketPoll
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-13 16:44:09 -05:00
Ashod Nakashian ba4e52e7b9 wsd: log: overload chrono duration to simplify logging
Also, makes the logging of units much less error prone.

The overloaded streaming operators are temporary as
they are provided in C++20. The ones here (though
incomplete) are fashioned after the C++20 specs.

Change-Id: Ieb499282ccb6e63fa939ba07bed3e5a4fbef1bd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-08 09:26:41 +00:00
Andras Timar 0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Ashod Nakashian 224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Michael Meeks 28a9c4dc05 Poll - cleanup method naming, and fix merge issues.
This mends several problems from commit
5710c86323.

Change-Id: I1b29f29ca81679608a2692488fa1ef22b2e62dfd
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92032
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 13:58:00 +02:00
Michael Meeks 5710c86323 Poll - switch to ppoll for closer to microsecond accuracy.
Change-Id: Ib8a2bb6f60302df8631edadbbb8db626894c457c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 10:06:23 +02:00
Miklos Vajna 6d57f0a005 net: make members private in DelaySocket
Change-Id: I5970d55f0723e46892ed5bea87bb79376c7ea530
2019-01-17 08:46:11 +01:00
Tor Lillqvist 3b4269a301 Use Util::symbolicErrno()
I think the general policy should be to always log errno using both
Util::symbolicErrno() and std::strerror(), never log a naked errno.
But only in cases where we know that it is highly likely that it is
the most recent system call that has failed, so errno makes sense.

Change-Id: I4a1fb31e375ea949e7da17687464361efe7c1761
2018-07-11 13:05:22 +03:00
Pranav Kant f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Michael Meeks 9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Michael Meeks ec12a0e16b DelaySocket: kill warning. 2017-04-24 11:39:31 +01:00
Michael Meeks 5d0e4fa020 DelaySocket: hide logging. 2017-04-22 18:42:16 +01:00
Michael Meeks 63aba6be1a DelaySocket: working, and much cleaner / simpler. 2017-04-22 18:42:16 +01:00
Michael Meeks 26a6d514d5 DelaySocket - simplified but working.
Assume for now that we have infinite space in-transit.
2017-04-22 18:42:16 +01:00
Michael Meeks 1c7f94045a Initial DelaySocket goodness. 2017-04-22 18:42:16 +01:00