This is useful when client submiting multiple IPC cmd in one socket connection. Signed-off-by: Asias He <asias.hejun@xxxxxxxxx> --- tools/kvm/kvm-ipc.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/kvm/kvm-ipc.c b/tools/kvm/kvm-ipc.c index 68c2565..f2c3523 100644 --- a/tools/kvm/kvm-ipc.c +++ b/tools/kvm/kvm-ipc.c @@ -74,7 +74,7 @@ static void kvm_ipc__close_conn(int fd) close(fd); } -static void kvm_ipc__new_data(int fd) +static int kvm_ipc__new_data(int fd) { struct kvm_ipc_msg *msg; u32 n; @@ -97,8 +97,11 @@ static void kvm_ipc__new_data(int fd) kvm_ipc__handle(fd, msg); + return 0; + done: free(msg); + return -1; } static void *kvm_ipc__thread(void *param) @@ -115,10 +118,16 @@ static void *kvm_ipc__thread(void *param) if (fd == stop_fd && event.events & EPOLLIN) { break; } else if (fd == server_fd) { - int client; + int client, r; client = kvm_ipc__new_conn(fd); - kvm_ipc__new_data(client); + /* + * Handle multiple IPC cmd at a time + */ + do { + r = kvm_ipc__new_data(client); + } while (r == 0); + } else if (event.events && (EPOLLERR | EPOLLRDHUP | EPOLLHUP)) { kvm_ipc__close_conn(fd); } else { -- 1.7.7.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html