add packet size limit to server,s et at 140 pixels atm

This commit is contained in:
Jan Klopper 2016-04-06 10:11:05 +02:00
parent e573ab4d94
commit 060693625f

View file

@ -38,6 +38,7 @@ class Canvas(object):
self.canvas() self.canvas()
self.set_title() self.set_title()
self.queue = queue self.queue = queue
self.limit = 140
@staticmethod @staticmethod
def set_title(text=None): def set_title(text=None):
@ -100,7 +101,8 @@ class Canvas(object):
) )
pixelcount = (len(data)-1) / pixellength pixelcount = (len(data)-1) / pixellength
if self.debug: if self.debug:
print '%d pixels received, protocol V %d ' % (pixelcount, protocol) print '%d pixels received, protocol V %d ' % (
min(pixelcount, self.limit), protocol)
for i in xrange(0, pixelcount): for i in xrange(0, pixelcount):
pixel = struct.unpack_from( pixel = struct.unpack_from(
packetformat, packetformat,