]> git.sur5r.net Git - i3/i3/commit
Use ipc queue for all messages (#3585)
authorOrestis <orestisf1993@gmail.com>
Sat, 12 Jan 2019 12:13:03 +0000 (14:13 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 23 Jan 2019 20:21:28 +0000 (21:21 +0100)
commit54e7a3156810e654812dd2a5fba1ca1bd9670ff3
treef0de15cbdba044f54221ab3041be7c0a542ddb33
parentcf375927f0822540515230d5eb69e08e9edc2dda
Use ipc queue for all messages (#3585)

I was able to reproduce #3579 in Linux by running:
`sudo sysctl net.core.wmem_default=10000`

If a subscription message was too big to be sent at once, it was
possible to break a client by sending a reply to an other message sent
by the client. Eg:
- Write 8192 out of 11612 bytes of a workspace event.
- Blockingly write the reply to a workspace change message.
- Write the rest 3420 bytes of the workspace event.

This commit fixes this by utilizing the ipc queue for all types of
writes.

ipc_receive_message can only be called from a callback started in
ipc_new_client. This callback uses the same file descriptor with the
client also created in ipc_new_client. When the client is deleted, the
read callback is now also stopped. Thus, we can assume that whenever
ipc_receive_message is called, the corresponding client should still
exist.

- ipc_client now contains pointers to both write and read watchers. When
freed, a client will stop both of them.
- IPC_HANDLERs now work with ipc_clients instead of fds.

Fixes #3579.
include/ipc.h
src/ipc.c