From 448ed75bd6c8db7ca48cab8aa1256a262e87fcc0 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 11 Apr 2011 12:44:00 +0300 Subject: server: Add RedClient That means RedClient tracks a ring of channels. Right now there will be only a single client because of the disconnection mechanism - whenever a new client comes we disconnect all existing clients. But this patch adds already a ring of clients to reds.c (stored in RedServer). There is a known problem handling many connections and disconnections at the same time, trigerrable easily by the following script: export NEW_DISPLAY=:3.0 Xephyr $NEW_DISPLAY -noreset & for ((i = 0 ; i < 5; ++i)); do for ((j = 0 ; j < 10; ++j)); do DISPLAY=$NEW_DISPLAY c_win7x86_qxl_tests & done sleep 2; done I fixed a few of the problems resulting from this in the same patch. This required already introducing a few other changes: * make sure all removal of channels happens in the main thread, for that two additional dispatcher calls are added to remove a specific channel client (RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT and RED_WORKER_MESSAGE_DISPLAY_DISCONNECT_CLIENT). * change some asserts in input channel. * make main channel disconnect not recursive * introduce disconnect call back to red_channel_create_parser The remaining abort is from a double free in the main channel, still can't find it (doesn't happen when running under valgrind - probably due to the slowness resulting from that), but is easy to see when running under gdb. --- server/red_dispatcher.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/red_dispatcher.h') diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h index fa347f19..07a95aec 100644 --- a/server/red_dispatcher.h +++ b/server/red_dispatcher.h @@ -18,6 +18,8 @@ #ifndef _H_RED_DISPATCHER #define _H_RED_DISPATCHER +struct RedChannelClient; + struct RedDispatcher *red_dispatcher_init(QXLInstance *qxl); void red_dispatcher_set_mm_time(uint32_t); @@ -30,5 +32,9 @@ uint32_t red_dispatcher_qxl_ram_size(void); int red_dispatcher_qxl_count(void); void red_dispatcher_async_complete(struct RedDispatcher*, uint64_t); -#endif +void red_dispatcher_disconnect_display_client(struct RedDispatcher *dispatcher, + struct RedChannelClient *rcc); +void red_dispatcher_disconnect_cursor_client(struct RedDispatcher *dispatcher, + struct RedChannelClient *rcc); +#endif -- cgit