Age | Commit message (Collapse) | Author |
|
When waiting for a specific message, only consider messages
from the peer endpoint. Otherwise a message with the same id
for the local endpoint may be misinterpreted.
This fixes the Terminal sometimes hanging after bootup because
a local endpoint message is mistaken for the CreateMenuResponse
message.
|
|
If we get an error from recv(), let's blame "recv" instead of "read".
|
|
This avoids getting into the awkward situation where the socket is
still part-owned by main() in multi-instance service. Also it just
reads nicer.
|
|
This stops servers from crashing when a client's socket buffer becomes
full and we can't post any more messages to it. Normally this means the
client process is hanged/spinning, but I suppose this could also happen
under severe system load.
It's unclear to me what a better solution here would be. We can't keep
buffering messages indefinitely if the client is just never going to
receive them anyway. At some point we have to cut our losses, and it
seems pretty reasonable to let the kernel socket buffer be the cutoff.
It will be the responsibility of the individual server implementations
to avoid sending messages to clients that may be unable to handle them.
|
|
|
|
Since SO_PEERCRED can only tell us who originally accepted the socket
on the other side, we'll sometimes need to negotiate PID info manually.
|
|
Instead of always running the responsiveness timer for IPC clients,
we now only start it after sending a message. This avoids waking up
otherwise idle clients to do ping/pong busywork.
|
|
|
|
Thanks @brynet for noticing. :^)
|
|
IPC::ClientConnection now tracks the time since the last time we got
a message from the client and calls a virtual function on itself after
3 seconds: may_have_become_unresponsive().
Subclasses of ClientConnection can then react to this if they like.
We use this mechanism in WindowServer to send out a friendly Ping
message to the client. If he doesn't Pong within 1 second, we mark
the client as "unresponsive" and recompose all of his windows with
a darkened appearance and amended title until he Pongs us.
This is a little on the aggressive side and we should figure out a way
to wake up less often. Perhaps this could only be done to windows the
user is currently interacting with, for example.
Anyways, this is pretty cool! :^)
|
|
|
|
|
|
The server should always survive client communication errors.
|
|
Closes https://github.com/SerenityOS/serenity/issues/2080
|
|
This was the last one! IPCCompiler no longer has any type-specific
encoding/decoding logic! :^)
|
|
Now most classes dictate how they are serialized and deserialized when
transmitted across LibIPC sockets. This also makes the IPC compiler
a bit simpler. :^)
|
|
|
|
We never want to store null messages, so make it impossible to do so.
|
|
|
|
...instead of looping for (effectively) ever.
Fixes https://github.com/SerenityOS/serenity/issues/1869
|
|
Same issue here as we had with RefPtr and NonnullRefPtr.
Since we can't make copies of an owning pointer, we don't get quite the
same static_ptr_cast<T> here. Instead I've only added a new templated
version of OwnPtr::release_nonnull() in this patch, to solve the only
issue that popped up.
I'm not sure what the best solution here is, but this works for now.
|
|
Instead of passing the BufferStream, pass the Decoder. I'd like to stop
using BufferStream eventually anyway, so it's good to get it out of any
API's where it's in currently.
|
|
|
|
Now that Vector uses size_t, we can remove a whole bunch of redundant
casts to size_t.
|
|
|
|
This patch adds <LibGUI/Forward.h> and uses it a bunch.
It also dragged various header dependency reduction changes into it.
|
|
This shaves ~5 seconds off of a full build, not too bad. Also it just
seems nicer to push this logic out to classes. It could be better but
it's a start. :^)
|
|
Compiling anything that includes generated IPC messages is painfully
slow at the moment. This moves the encoding helpers out of line, which
helps a bit. Doing the same for decoding will help more.
|
|
|
|
This patch adds <LibCore/Forward.h> and uses it in various places to
shrink the header dependency graph.
|
|
You can now #include <AK/Forward.h> to get most of the AK types as
forward declarations.
Header dependency explosion is one of the main contributors to compile
times at the moment, so this is a step towards smaller include graphs.
|
|
|
|
|
|
|
|
Clients of this code should use explicitly-sized types instead.
|
|
|
|
|
|
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.
The new convention is:
- "LibFoo" is a userspace library that provides the "Foo" namespace.
That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
|
|
To allow for more asynchronous teardown of IClientConnection, make the
post_message() function simply return if called after the IPC socket
has been closed.
|
|
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.
For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.
Going forward, all new source files should include a license header.
|
|
Instead of using ByteBuffer (which always malloc() their storage) for
IPC message encoding, we now use a Vector<u8, 1024>, which means that
messages smaller than 1 KB avoid heap allocation entirely.
|
|
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'. Also support these in any particular subdirectory.
Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.
Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
|
|
A client that only ever does synchronous IPC calls from its side would
never actually process incoming asynchronous messages since they would
arrive while waiting for a synchronous response and then end up sitting
forever in the "unhandled messages" queue.
We now always handle unhandled messages using a deferred invocation.
This fixes the bug where Audio.MenuApplet didn't learn that the muted
state changed in response to its own request to change it. :^)
|
|
|
|
Instead of passing the PIDs back and forth in a handshake "Greet"
message, just use getsockopt(SO_PEERCRED) on both sides to get the same
information from the kernel.
This is a nice little simplification of the IPC protocol, although it
does not get rid of the handshake since we still have to pass the
"client ID" from the server to each client so they know how to refer
to themselves. This might not be necessary and we might be able to get
rid of this later on.
|
|
If a client sends an invalid window ID or similar to the WindowServer,
we'll now immediately mark them as misbehaving and disconnect them.
This might be too aggressive in some cases (window management, ...)
but it's just a place to start.
|
|
Hogging "id" and "name" makes it impossible to use these as message
parameter names, which seems silly. :^)
|
|
When draining the socket in IServerConnection, we would previously
handle each incoming (local endpoint) message as it came in.
This would cause unexpected things to happen while blocked waiting
for a synchronous response. That's definitely not what we want,
so this patch puts all of the incoming messages in a queue and does
a separate pass over the queue to handle everything in order.
|
|
This matches what we're already calling the server-side subclasses
better, though we'll probably want to find some better names for the
client-side classes eventually.
|
|
Move over the CoreIPC::Server and CoreIPC::Client namespace stuff
into LibIPC where it will soon becomes LibIPC-style things.
|