Main-Tomi commented on issue #633:
URL: https://github.com/apache/mina-sshd/issues/633#issuecomment-2477738550
Through testing, it was found that the slow loading of file directories is
due to the following method(class is:
org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper):
The first place:**Map<String, ?> attrs = resolveFileAttributes(f,
SftpConstants.SSH_FILEXFER_ATTR_ALL, !followLinks, options);**, it takes 6-7
milliseconds each time.
Second place: **accessor.putRemoteFileName(this, f, buffer, shortName,
true);**, it takes 5-6 milliseconds each time.
```
protected void writeDirEntry(
int id, DirectoryHandle dir, Map<String, Path> entries, Buffer
buffer,
int index, Path f, String shortName, LinkOption... options)
throws IOException {
boolean followLinks =
resolvePathResolutionFollowLinks(SftpConstants.SSH_FXP_READDIR, "", f);
Map<String, ?> attrs = resolveFileAttributes(
f, SftpConstants.SSH_FILEXFER_ATTR_ALL, !followLinks,
options);
entries.put(shortName, f);
SftpFileSystemAccessor accessor = getFileSystemAccessor();
ServerSession session = getServerSession();
accessor.putRemoteFileName(this, f, buffer, shortName, true);
int version = getVersion();
if (version == SftpConstants.SFTP_V3) {
String longName = getLongName(f, shortName, options);
accessor.putRemoteFileName(this, f, buffer, longName, false);
if (log.isTraceEnabled()) {
log.trace("writeDirEntry({} id={})[{}] - {} [{}]: {}",
session, id, index, shortName, longName, attrs);
}
} else {
if (log.isTraceEnabled()) {
log.trace("writeDirEntry({} id={})[{}] - {}: {}", session,
id, index, shortName, attrs);
}
}
writeAttrs(buffer, attrs);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]