@SuppressWarnings("synthetic-access") @Override public void run() { try { byte[] buf = new byte[1024]; while (true) { int result = Socket.recv(socket, buf, 0, buf.length); if (result == -Status.APR_EOF) { break; } else if (result < Status.APR_SUCCESS) { throwException(result); } messageReceived(new ByteArrayBuffer(buf, 0, result)); } } catch (Exception e) { log.error("Failed to process", e); } finally { Socket.close(socket); } }
public String start() throws Exception { authSocket = AprLibrary.createLocalSocketAddress(); pool = Pool.create(AprLibrary.getInstance().getRootPool()); handle = Local.create(authSocket, pool); int result = Local.bind(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } AprLibrary.secureLocalSocket(authSocket, handle); result = Local.listen(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } CloseableExecutorService executor = getExecutorService(); agentThread = executor.submit(() -> { try { while (true) { long clientSock = Local.accept(handle); Socket.timeoutSet(clientSock, 10000000); // TODO make this configurable new SshAgentSession(clientSock, agent).run(); } } catch (Exception e) { log.error("Failed to run session", e); } }); return authSocket; }
public String start() throws Exception { authSocket = AprLibrary.createLocalSocketAddress(); pool = Pool.create(AprLibrary.getInstance().getRootPool()); handle = Local.create(authSocket, pool); int result = Local.bind(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } AprLibrary.secureLocalSocket(authSocket, handle); result = Local.listen(handle, 0); if (result != Status.APR_SUCCESS) { throwException(result); } CloseableExecutorService executor = getExecutorService(); agentThread = executor.submit(() -> { try { while (true) { long clientSock = Local.accept(handle); Socket.timeoutSet(clientSock, 10000000); // TODO make this configurable new SshAgentSession(clientSock, agent).run(); } } catch (Exception e) { log.error("Failed to run session", e); } }); return authSocket; }
@SuppressWarnings("synthetic-access") @Override public void run() { try { byte[] buf = new byte[1024]; while (true) { int result = Socket.recv(socket, buf, 0, buf.length); if (result == -Status.APR_EOF) { break; } else if (result < Status.APR_SUCCESS) { throwException(result); } messageReceived(new ByteArrayBuffer(buf, 0, result)); } } catch (Exception e) { log.error("Failed to process", e); } finally { Socket.close(socket); } }