[CRIU] [PATCH] p.haul: increase the buffer size in xem_rpc

Andrew Vagin avagin at openvz.org
Fri Sep 4 08:35:18 PDT 2015


The hack with MSG_PEEK | MSG_TRUNC which was introduced
in my previous patch doesn't work for tcp sockets.

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 phaul/xem_rpc.py | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/phaul/xem_rpc.py b/phaul/xem_rpc.py
index e995c0a..d3c196d 100644
--- a/phaul/xem_rpc.py
+++ b/phaul/xem_rpc.py
@@ -1,4 +1,3 @@
-import ctypes
 import socket
 import select
 import threading
@@ -6,6 +5,7 @@ import traceback
 import util
 
 rpc_port = 12345
+rpc_sk_buf = 16384
 
 RPC_CMD = 1
 RPC_CALL = 2
@@ -13,14 +13,6 @@ RPC_CALL = 2
 RPC_RESP = 1
 RPC_EXC = 2
 
-libc = None
-
-def get_message_size(sk):
-	global libc
-	if not libc:
-		libc = ctypes.CDLL("libc.so.6")
-	return libc.recv(sk.fileno(), 0, 0, socket.MSG_PEEK | socket.MSG_TRUNC)
-
 #
 # Client
 #
@@ -35,7 +27,6 @@ class _rpc_proxy_caller:
 		call = (self._fn_typ, self._fn_name, args)
 		raw_data = repr(call)
 		self._rpc_sk.send(raw_data)
-		rpc_sk_buf = get_message_size(self._rpc_sk)
 		raw_data = self._rpc_sk.recv(rpc_sk_buf)
 		resp = eval(raw_data)
 
@@ -90,7 +81,6 @@ class _rpc_server_sk:
 		return self.hash_name()
 
 	def work(self, mgr):
-		rpc_sk_buf = get_message_size(self._sk)
 		raw_data = self._sk.recv(rpc_sk_buf)
 		if not raw_data:
 			mgr.remove(self)
-- 
2.4.3



More information about the CRIU mailing list