talkincode / toughradius

toughradius provides radius server, tr069 acs
http://www.toughradius.net
GNU General Public License v3.0
564 stars 272 forks source link

`RADIUSAuthWorker` 为什么要继承 `protocol.DatagramProtocol` 而且监听 UDP? #106

Closed XhinLiang closed 6 years ago

XhinLiang commented 7 years ago

RADIUSAuthWorker 按我的理解应该是在 ZMQ 里取数据然后进行验证的呀,他为什么要继承 protocol.DatagramProtocol 这个类而且不实现 datagramReceive 方法。 代码如下:

class RADIUSAuthWorker(protocol.DatagramProtocol):

    def __init__(self, config, dbengine, radcache=None):
        self.config = config
        self.dict = dictionary.Dictionary(
            os.path.join(os.path.dirname(toughradius.__file__), 'dictionarys/dictionary'))
        self.db_engine = dbengine or get_engine(config)
        self.aes = utils.AESCipher(key=self.config.system.secret)
        self.mcache = radcache
        self.pusher = ZmqPushConnection(ZmqFactory(), ZmqEndpoint('connect', 'ipc:///tmp/radiusd-auth-result'))
        self.stat_pusher = ZmqPushConnection(ZmqFactory(), ZmqEndpoint('connect', 'ipc:///tmp/radiusd-stat-task'))
        self.puller = ZmqPullConnection(ZmqFactory(), ZmqEndpoint('connect', 'ipc:///tmp/radiusd-auth-message'))
        self.puller.onPull = self.process
        reactor.listenUDP(0, self)
        logger.info("init auth worker pusher : %s " % (self.pusher))
        logger.info("init auth worker puller : %s " % (self.puller))
        logger.info("init auth stat pusher : %s " % (self.stat_pusher))
jamiesun commented 7 years ago

遗留问题,曾经用来发送UDP消息