[CRIU] [PATCH 1/3] service: Do one exit point from cr_service_work

Pavel Emelyanov xemul at parallels.com
Thu Sep 4 09:37:34 PDT 2014


That's preparation to "several requests per connection" patch.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-service.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/cr-service.c b/cr-service.c
index c42b238..d48c2ec 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -533,6 +533,7 @@ out:
 
 int cr_service_work(int sk)
 {
+	int ret = -1;
 	CriuReq *msg = 0;
 
 	if (recv_criu_msg(sk, &msg) == -1) {
@@ -542,23 +543,27 @@ int cr_service_work(int sk)
 
 	switch (msg->type) {
 	case CRIU_REQ_TYPE__DUMP:
-		return dump_using_req(sk, msg->opts);
+		ret = dump_using_req(sk, msg->opts);
+		break;
 	case CRIU_REQ_TYPE__RESTORE:
-		return restore_using_req(sk, msg->opts);
+		ret = restore_using_req(sk, msg->opts);
+		break;
 	case CRIU_REQ_TYPE__CHECK:
-		return check(sk);
+		ret = check(sk);
+		break;
 	case CRIU_REQ_TYPE__PRE_DUMP:
-		return pre_dump_loop(sk, msg);
+		ret = pre_dump_loop(sk, msg);
+		break;
 	case CRIU_REQ_TYPE__PAGE_SERVER:
-		return start_page_server_req(sk, msg->opts);
+		ret =  start_page_server_req(sk, msg->opts);
+		break;
 
 	default:
 		send_criu_err(sk, "Invalid req");
-		goto err;
+		break;
 	}
-
 err:
-	return -1;
+	return ret;
 }
 
 static void reap_worker(int signo)
-- 
1.8.4.2



More information about the CRIU mailing list