refactoring
This commit is contained in:
parent
f8672bdd6d
commit
97a357ae00
@ -58,7 +58,7 @@ class SyncClientProtocol(CommandProtocol):
|
||||
def handle_connected_state(self, args):
|
||||
args = self.__parseState(args)
|
||||
if not args:
|
||||
self.drop_with_error('Malformed state attributes')
|
||||
self.dropWithError('Malformed state attributes')
|
||||
return
|
||||
|
||||
counter, ctime, paused, position, name = args
|
||||
@ -72,7 +72,7 @@ class SyncClientProtocol(CommandProtocol):
|
||||
ctime = int(ctime)
|
||||
position = int(position)
|
||||
except ValueError:
|
||||
self.drop_with_error('Invalid arguments')
|
||||
self.dropWithError('Invalid arguments')
|
||||
|
||||
ctime /= 1000.0
|
||||
position /= 1000.0
|
||||
|
||||
@ -42,7 +42,7 @@ class CommandProtocol(LineReceiver):
|
||||
|
||||
args = ArgumentParser.splitArguments(line)
|
||||
if not args:
|
||||
self.drop_with_error('Malformed line')
|
||||
self.dropWithError('Malformed line')
|
||||
return
|
||||
command = args.pop(0)
|
||||
#if command not in ['ping', 'pong']:
|
||||
@ -56,7 +56,7 @@ class CommandProtocol(LineReceiver):
|
||||
if handler:
|
||||
handler = getattr(self, handler, None)
|
||||
if not handler:
|
||||
self.drop_with_error('Unknown command: `%s`' % command)
|
||||
self.dropWithError('Unknown command: `%s`' % command)
|
||||
return # TODO log it too
|
||||
handler(args)
|
||||
|
||||
@ -77,7 +77,7 @@ class CommandProtocol(LineReceiver):
|
||||
def drop(self):
|
||||
self.transport.loseConnection()
|
||||
|
||||
def drop_with_error(self, error):
|
||||
def dropWithError(self, error):
|
||||
self.send_message('error', error)
|
||||
self.drop()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user