public MinaAcceptor(FactoryManager manager, org.apache.sshd.common.io.IoHandler handler) {
super(manager, handler);
}
protected IoAcceptor createAcceptor() {
NioSocketAcceptor acceptor = new NioSocketAcceptor(getNioWorkers());
acceptor.setCloseOnDeactivation(false);
acceptor.setReuseAddress(reuseAddress);
acceptor.setBacklog(backlog);
// MINA itself forces our socket receive buffer to 1024 bytes
// by default, despite what the operating system defaults to.
// This limits us to about 3 MB/s incoming data transfer. By
// forcing back to the operating system default we can get a
// decent transfer rate again.
//
final Socket s = new Socket();
try {
try {
acceptor.getSessionConfig().setReceiveBufferSize(s.getReceiveBufferSize());
} finally {
s.close();
}
} catch (IOException e) {
log.warn("cannot adjust SO_RCVBUF back to system default", e);
}
if (sessionConfig != null) {
acceptor.getSessionConfig().setAll(sessionConfig);
}
return acceptor;
}