mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-29 11:20:08 +01:00
proto: add a bunch of error reasons for debugging
This commit is contained in:
parent
55a12f5cae
commit
dd5bc6b6e7
2 changed files with 16 additions and 6 deletions
|
|
@ -301,9 +301,19 @@
|
|||
provide information to the client on whether it was disconnected as
|
||||
part of normal operations or as result of an error on either the client
|
||||
or EIS implementation side.
|
||||
|
||||
A nonzero value describes an error, with the generic value "error" (1) reserved
|
||||
as fallback.
|
||||
|
||||
This enum may be extended in the future, clients must be able to handle
|
||||
values that are not in their supproted version of this enum.
|
||||
</description>
|
||||
<entry name="disconnected" value="0" help="client was purposely disconnected"/>
|
||||
<entry name="error" value="1" help="an error caused the disconnection"/>
|
||||
<entry name="mode" value="2" help="sender/receiver client sent request for receiver/sender mode"/>
|
||||
<entry name="protocol" value="3" help="client committed a protocol violation"/>
|
||||
<entry name="value" value="4" help="client sent an invalid value"/>
|
||||
<entry name="transport" value="5" help="error on the transport layer"/>
|
||||
</enum>
|
||||
|
||||
<event name="disconnected" type="destructor" since="1">
|
||||
|
|
@ -312,11 +322,11 @@
|
|||
the client is disconnected.
|
||||
|
||||
Where a client is disconnected by EIS on purpose, for example after
|
||||
a user interaction, the reason is disconnect_reason.disconnected and
|
||||
the explanation is NULL.
|
||||
a user interaction, the reason is disconnect_reason.disconnected (i.e. zero)
|
||||
and the explanation is NULL.
|
||||
|
||||
Where a client is disconnected due to some invalid request or other
|
||||
protocol error, the reason is disconnect_reason.error and
|
||||
protocol error, the reason is one of disconnect_reason (i.e. nonzero) and
|
||||
explanation may contain a string explaining why. This string is
|
||||
intended to help debugging only and is not guaranteed to stay constant.
|
||||
|
||||
|
|
|
|||
|
|
@ -323,10 +323,10 @@ brei_dispatch(struct brei_context *brei,
|
|||
if (rc == -EAGAIN) {
|
||||
return NULL;
|
||||
} else if (rc == 0) {
|
||||
return brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_ERROR,
|
||||
return brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_TRANSPORT,
|
||||
"socket disconnected");
|
||||
} else if (rc < 0) {
|
||||
return brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_ERROR,
|
||||
return brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_TRANSPORT,
|
||||
"error: %s", strerror(-rc));
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ brei_dispatch(struct brei_context *brei,
|
|||
assert(interface);
|
||||
|
||||
if (opcode >= interface->nincoming) {
|
||||
result = brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_ERROR,
|
||||
result = brei_result_new(BREI_CONNECTION_DISCONNECT_REASON_PROTOCOL,
|
||||
"opcode %u exceeds interface %s method count %u",
|
||||
opcode, interface->name, interface->nincoming);
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue