This makes generation of files with the scanner a lot more flexible -
e.g. one can run the scanner with
--jinja-extra-data='{ "interface": "ei_connection"}'
and then in the jinja template use an if condition to match on this
interface.
This *should* have happened when the client got disconnected but in some
race conditions a seat may be added after the client gets disconnected.
Reproducible (sometimes) by test_invalid_object_id with the
eis-demo-server:
- client connects, sends invalid object ID, gets disconnected
- server sees CONNECTED, adds a seat, then sees DISCONNECTED and drops
the client.
From the demo-server's POV the seat is handled by the client, so it
expects the client to destroy it.
A lot of the protocol tests have enforced timeouts because we need to
wait for the server to do something (or not). Running the protocol tests
with xdist means we can run those in parallel, which on my local box
roughly halves the time required to run all protocol tests.
Of course, this is all terrible. The only way to tell pytest to use
xdist is with `pytest -n <jobcount>`. But -n is only available if xdist
is installed. Dynamically adding commandline options is supposed to
be possible with `pytest_load_initial_conftests` in conftest.py, but
that doesn't actually work unless we're configuring a setuptool plugin.
Which we don't. What would work is `pytest_cmdline_preparse` but that
has been deprecated.
So we work around this by having meson check if xdist is available and
append `-n auto` for us.
In the CI let's be nice and only use the FDI_CI_CONCURRENT number of
jobs rather than hogging everything available. And, continuation from
"all is terrible": pytest complains if you have a hook that's unknown.
So if xdist is not available, you must not have the hook in conftest.py.
Which means we have to do it within an import + ImportError clause.
But yay, now we're saving literally seconds!
We still have the separate CI jobs for those (for better visibility) but
also optionally incorporate those into the meson test run.
Both calls only check the files, they do not modify anything.
As the protocol spec says, EIS should treat this as already disconnected
and not touch the connection.
This fixes a memleak if a client connects and immediately disconnects -
when EIS processes the EIS_EVENT_CLIENT_CONNECT it may set up a bunch of
things like seats (the eis-demo-server does this). Then, later, when
the EIS_EVENTE_CLIENT_DISCONNECT is processed, it calls
eis_client_disconnect() but we were already in the disconnected state
and the seats would not get released.
This is somewhat superior to just crashing with a SIGSEGV and we have a
valid case for this in libei - when the client switches to the
disconnected state but keeps sending events we just ignore the messages.
On some architectures (ARM, afaik) addresses needs to be a multiple
of their word size. Since the protocol doesn't enforce alignment on
multiples of 8, let's use a memcpy to copy any 64-bit number instad of
the pointer access.
Now that we have 64 bit integers on the wire and 64 bit object IDs,
we're already different to the Wayland protocol. So we might as well get
the full length and split message length and opcode again to make header
parsing and composing simpler.
This effectively reverts commit bf45a7182cb2f4c13f11e141fc846244d3ac6212.
Previously, we'd send one interface_version event for "ei_handshake"
immediately but all others after the client requests handshake.finish.
This was too confusing to document and not clear how it would work, so
let's make this simpler by splitting it up.
There is now a handshake_version event from the server, sent immediately
on connection that denotes the maximum version number for the interface.
And a handshake_version request from the client which must be the first
one by the client.
These were previously (1 << cap) for convenience but that results in the
capability mask on the wire starting at 2 - which is a bit awkward.
Lets shift them down by one so we start the mask at 1.
Add another run to the XML parser so we parse enums before Arguments
that cross-reference enums from other interfaces.
This also fixes a type bug - the enum name string was passed to
Argument.create() as Enum and no-one noticed.