Fixed the problem with pixels missing in the message and prevented general exceptions from crashing the server.

This commit is contained in:
CodePanter 2016-04-07 20:56:28 +02:00
parent 060693625f
commit d781d85745
2 changed files with 26 additions and 25 deletions

View file

@ -14,7 +14,6 @@ import random
import time
class MaxSizeList(list):
maxsize = 0
def __init__(self, maxcount=100):
self.maxsize = maxcount
@ -25,7 +24,6 @@ class MaxSizeList(list):
if self.__len__() == self.maxsize:
raise IndexError('max size reached')
def RGBPixel(x, y, r, g, b, a=None): # pylint: disable=C0103
"""Generates the packed data for a pixel"""
if a:
@ -55,7 +53,7 @@ def RandomFill(width=640, height=480):
message.append(pixel)
except IndexError:
yield ''.join(message)
message[:] = []
message[2:] = []
message.append(pixel)
yield ''.join(message)