mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 22:32:26 +00:00
Add SSHMaster::Connection::trySetBufferSize
It is unused in Nix currently, but will be used in Hydra. This reflects what Hydra does in https://github.com/NixOS/hydra/pull/1387. We may probalby to use it more widely for better SSH store performance, but this needs to be subject to more testing before we do that.
This commit is contained in:
parent
7de033d63f
commit
05be135783
@ -194,4 +194,14 @@ Path SSHMaster::startMaster()
|
||||
|
||||
#endif
|
||||
|
||||
void SSHMaster::Connection::trySetBufferSize(size_t size)
|
||||
{
|
||||
#ifdef F_SETPIPE_SZ
|
||||
// convert type
|
||||
int pipesize = size;
|
||||
fcntl(in.get(), F_SETPIPE_SZ, pipesize);
|
||||
fcntl(out.get(), F_SETPIPE_SZ, pipesize);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,6 +51,16 @@ public:
|
||||
Pid sshPid;
|
||||
#endif
|
||||
AutoCloseFD out, in;
|
||||
|
||||
/**
|
||||
* Try to set the buffer size in both directions to the
|
||||
* designated amount, if possible. If not possible, does
|
||||
* nothing.
|
||||
*
|
||||
* Current implementation is to use `fcntl` with `F_SETPIPE_SZ`,
|
||||
* which is Linux-only.
|
||||
*/
|
||||
void trySetBufferSize(size_t size);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user