function P2pCheck(tab)
	local p2pHelper = XLGetObject("Xunlei.P2pCheckHelper.Obj")
	p2pHelper:Init()
	p2pHelper:StartP2pCheck(8)
	
	local obj = XLGetObject("Xunlei.OSShell.Obj")
	for i=1,25 do
		obj:Sleep(1000)
		local type, p2pSpeed, httpSpeed = p2pHelper:GetP2pCheckResult()
		if type==1 then
			if httpSpeed==-1 or p2pSpeed==-1 then
				p2pHelper:Uninit()
				return 0
			end
			
			if httpSpeed==0 and p2pSpeed==0 then
				p2pHelper:Uninit()
				return 1
			end		
			
			if p2pSpeed<httpSpeed/3 and p2pSpeed<200 then
				p2pHelper:Uninit()
				return 1
			else
				p2pHelper:Uninit()
				return 0
			end
		elseif type==3 then
			p2pHelper:Uninit()
			return 0
		end
	end
	
	p2pHelper:Uninit()
	return 0
end
