Class UnixDomainSocketConnector
java.lang.Object
org.eclipse.jgit.transport.sshd.agent.AbstractConnector
org.eclipse.jgit.internal.transport.sshd.agent.connector.UnixDomainSocketConnector
- All Implemented Interfaces:
Closeable,AutoCloseable,Connector
JNA-based implementation of communication through a Unix domain socket.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicBooleanstatic final ConnectorFactory.ConnectorDescriptorprivate static UnixSocketsprivate static booleanprivate static final org.slf4j.Loggerprivate intprivate final StringFields inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
DEFAULT_MAX_REPLY_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanconnect()Connects to an SSH agent if there is one running.private static UnixSocketsprivate intread(int fd, byte[] buffer, int offset, int length) private voidreadFully(int fd, byte[] data) byte[]rpc(byte command, byte[] message) Performs a remote call to the SSH agent and returns the result.private voidwriteFully(int fd, byte[] message) Methods inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
getMaximumMessageLength, prepareMessage, toLength
-
Field Details
-
DESCRIPTOR
-
LOG
private static final org.slf4j.Logger LOG -
library
-
libraryLoaded
private static boolean libraryLoaded -
socketFile
-
connected
-
socketFd
private volatile int socketFd
-
-
Constructor Details
-
UnixDomainSocketConnector
Creates a new instance.- Parameters:
socketFile- to use; ifnullor empty, use environment variable SSH_AUTH_SOCK
-
-
Method Details
-
getLibrary
-
connect
Description copied from interface:ConnectorConnects to an SSH agent if there is one running. If called when already connected just returnstrue.- Returns:
trueif an SSH agent is available and connected, if no SSH agent is available- Throws:
IOException- if connecting to the SSH agent failed
-
close
- Throws:
IOException
-
rpc
Description copied from interface:ConnectorPerforms a remote call to the SSH agent and returns the result.- Parameters:
command- to sendmessage- to send; must have at least 5 bytes, and must have 5 unused bytes at the front.- Returns:
- the result received
- Throws:
IOException- if an error occurs
-
writeFully
- Throws:
IOException
-
readFully
- Throws:
IOException
-
read
- Throws:
IOException
-