|
|
|
@ -74,9 +74,13 @@ class listener:
|
|
|
|
|
self.client_map[connstream.fileno()] = new_client
|
|
|
|
|
self.client_list.append(new_client)
|
|
|
|
|
else:
|
|
|
|
|
data = sock.recv(1024)
|
|
|
|
|
cur_client = self.client_map[sock.fileno()]
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
data = sock.recv(1024)
|
|
|
|
|
except socket.error, (value, message):
|
|
|
|
|
cur_client.abort(message)
|
|
|
|
|
else:
|
|
|
|
|
if data:
|
|
|
|
|
cur_client.process_data(data)
|
|
|
|
|
else:
|
|
|
|
@ -106,10 +110,7 @@ class client:
|
|
|
|
|
self.user = user(self, server)
|
|
|
|
|
self.listener = listener
|
|
|
|
|
|
|
|
|
|
def send_chunk(self, chunk):
|
|
|
|
|
try:
|
|
|
|
|
self.stream.send(chunk + EOC)
|
|
|
|
|
except socket.error:
|
|
|
|
|
def abort(self, reason):
|
|
|
|
|
# TODO: Log quit reason
|
|
|
|
|
try:
|
|
|
|
|
self.stream.shutdown(2)
|
|
|
|
@ -119,7 +120,13 @@ class client:
|
|
|
|
|
|
|
|
|
|
self.end()
|
|
|
|
|
self.listener.select_inputs = remove_from_list(self.listener.select_inputs, self.stream)
|
|
|
|
|
print "NOTICE: Client disconnected, possibly due to socket error"
|
|
|
|
|
print "NOTICE: Client disconnected, possibly due to socket error: %s" % reason
|
|
|
|
|
|
|
|
|
|
def send_chunk(self, chunk):
|
|
|
|
|
try:
|
|
|
|
|
self.stream.send(chunk + EOC)
|
|
|
|
|
except socket.error, (value, message):
|
|
|
|
|
self.abort(message)
|
|
|
|
|
|
|
|
|
|
def send_global_notice(self, notice):
|
|
|
|
|
self.send_chunk(":%s NOTICE %s" % (config_ownhost, notice))
|
|
|
|
|