f153c49430
fixes issue #484 (race condition with message to/from weston launch) The race condition occurs after weston sends the WESTON_LAUNCHER_OPEN message to weston-launch. The race is between when weston-launch replies with the fd handle versus weston-launch sending an activation message. If weston-launch sends an activation message before sending the fd handle, then weston will be in an invalid state. To fix this, I modified the fd handle reply that weston-launch sends to include a message id at the beginning, which I called WESTON_LAUNCHER_OPEN_REPLY. Along with this, weston now inspects the first part of any reply to determine whether it is an activation message or a reply to the OPEN message. In the newly handled case that it's an activation message, it tracks whether the latest result is a deactivate message and stores it in a flag to be handled once the open function has completed. Signed-off-by: Jonathan Marler <johnnymarler@gmail.com>
53 lines
1.6 KiB
C
53 lines
1.6 KiB
C
/*
|
|
* Copyright © 2012 Benjamin Franzke
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
* a copy of this software and associated documentation files (the
|
|
* "Software"), to deal in the Software without restriction, including
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
* the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the
|
|
* next paragraph) shall be included in all copies or substantial
|
|
* portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
#ifndef _WESTON_LAUNCH_H_
|
|
#define _WESTON_LAUNCH_H_
|
|
|
|
enum weston_launcher_opcode {
|
|
WESTON_LAUNCHER_OPEN,
|
|
};
|
|
|
|
enum weston_launcher_event {
|
|
WESTON_LAUNCHER_SUCCESS,
|
|
WESTON_LAUNCHER_ACTIVATE,
|
|
WESTON_LAUNCHER_DEACTIVATE,
|
|
WESTON_LAUNCHER_DEACTIVATE_DONE,
|
|
// This event is followed by an fd handle
|
|
WESTON_LAUNCHER_OPEN_REPLY,
|
|
};
|
|
|
|
struct weston_launcher_message {
|
|
int opcode;
|
|
};
|
|
|
|
struct weston_launcher_open {
|
|
struct weston_launcher_message header;
|
|
int flags;
|
|
char path[0];
|
|
};
|
|
|
|
#endif
|