'Send a greeting to the client and begin processing commands
as they arrive.'

def run(self):

    (yield self.send(HELLO))
    clist = None
    while True:
        line = (yield self.sock.readline())
        if (not line):
            break
        line = line.strip()
        if (not line):
            break
        line = line.decode('utf8')
        log.debug(u'{}', line)
        if (clist is not None):
            if (line == CLIST_END):
                (yield bluelet.call(self.do_command(clist)))
                clist = None
            else:
                clist.append(Command(line))
        elif ((line == CLIST_BEGIN) or (line == CLIST_VERBOSE_BEGIN)):
            clist = CommandList([], (line == CLIST_VERBOSE_BEGIN))
        else:
            try:
                (yield bluelet.call(self.do_command(Command(line))))
            except BPDClose:
                self.sock.close()
                return
