I have an issue. My producer-consumer on this chat server I've built is being stuck. Here's what it does: it gives the clients turns to send their messages, and when that random client(inside race of my computer) sends his message, all the messages clients tried to send before are being sent. I cannot find the issue, maybe someone can spot it?
def run(self):
global condition
global messages
is_running = 1
while is_running:
print "waiting to receive from: " + self.usersock.getpname()
inp = self.sock.recv(8192)
condition.acquire()
parts = inp.split(':-:321')
if parts[0] == "4":
while not noMessagesToSend(messages):
condition.wait()
mes = message.message(str(datetime.datetime.now().time())[:8], self.usersock.id, parts[3],parts[4])
if not mes.getgroup() in messages.keys():
messages.update({mes.getgroup():[]})
messages[mes.getgroup()].append(mes)
condition.notifyAll()
condition.release()
else:
print parts