use of io.mycat.proxy.handler.front.MySQLClientAuthHandler in project Mycat2 by MyCATApache.
the class MycatSessionManager method acceptNewSocketChannel.
@Override
public void acceptNewSocketChannel(Object keyAttachement, BufferPool bufPool, Selector nioSelector, SocketChannel frontChannel) throws IOException {
MySQLClientAuthHandler mySQLClientAuthHandler = new MySQLClientAuthHandler(this);
MycatSession mycat = new MycatSession(new MycatDataContextImpl(), bufPool, mySQLClientAuthHandler, this);
// 用于monitor监控获取session
SessionThread thread = (SessionThread) Thread.currentThread();
thread.setCurSession(mycat);
try {
mycat.register(nioSelector, frontChannel, SelectionKey.OP_READ);
MycatMonitor.onNewMycatSession(mycat);
mySQLClientAuthHandler.sendAuthPackge(mycat);
this.mycatSessions.add(mycat);
} catch (Exception e) {
MycatMonitor.onAuthHandlerWriteException(mycat, e);
mycat.close(false, e);
}
}
Aggregations