+
+ if (!callback) {
+ /*
+ * Bodge to permit making deliberately synchronous agent
+ * requests. Used by Unix Pageant in command-line client mode,
+ * which is legit because it really is true that no other part
+ * of the program is trying to get anything useful done
+ * simultaneously. But this special case shouldn't be used in
+ * any more general program.
+ */
+ no_nonblock(conn->fd);
+ while (!agent_try_read(conn))
+ /* empty loop body */;
+
+ *out = conn->retbuf;
+ *outlen = conn->retlen;
+ sfree(conn);
+ return 1;
+ }
+
+ /*
+ * Otherwise do it properly: add conn to the tree of agent
+ * connections currently in flight, return 0 to indicate that the
+ * response hasn't been received yet, and call the callback when
+ * select_result comes back to us.
+ */
+ if (!agent_connections)
+ agent_connections = newtree234(agent_conncmp);