Hi I've been trying to implement an SCP server with an in-memory FileSystem, so files can be transferred directly into the receiving application over SSH (rather than disk-polling).
An example of my implementation is https://gist.github.com/ian-kent/75bcb2197d757e584e10 This initially works ok, and the first file I transfer using scp works and its contents printed to the console. However, any subsequent requests (whether thats multiple files in one scp command, or multiple scp commands) fail with an scp error of "lost connection". I've run scp with -vvvv flags, and SSHD with its logging set to TRACE. When the transfer fails (i.e. all subsequent requests), the output from both scp and SSHD report everything as being ok, other than the final "lost connection" error on the client. The only difference is that the actual file content doesn't get transferred, but I couldn't see anything which suggests why that doesn't happen. This seems to be related to using an in-memory file system. If I comment out lines 55 - 60 on the sample code, so SSHD defaults to using a real file system, everything works reliably as expected, which suggests its probably not directly a Mina/SSHD bug. I've tried multiple in-memory file systems including google/JimFS, marschall/memoryfilesystem and openCage/memoryfs (all on GitHub), and all of them suffer from the same problem. Is there something I might have missed, e.g. a FileSystem feature not implemented by any of those in-memory implementations, or does anyone have any ideas why this might not be working? Thanks Ian Kent
