- struct connection *con = host->connections;
- while (con)
- {
- if (con->state == Conn_Resolving)
- {
- if (!host->ipport) /* unresolved */
- {
- connection_destroy(con);
- /* start all over .. at some point it will be NULL */
- con = host->connections;
- continue;
- }
- else if (!con->client)
- {
- connection_destroy(con);
- /* start all over .. at some point it will be NULL */
- con = host->connections;
- continue;
- }
- else
- {
- connection_connect(con);
- client_start_search(con->client);
- }
- }
- else
- {
- yaz_log(YLOG_LOG, "connect_resolver_host: state=%d", con->state);
- }
- con = con->next;
- }
-}
-
-static struct host *connection_get_host(struct connection *con)
-{
- return con->host;
-}
-
-// Callback for use by event loop
-// We do this because ZOOM connections don't always have (the same) sockets
-static int socketfun(IOCHAN c)
-{
- struct connection *co = iochan_getdata(c);
- if (!co->link)
- return -1;
- return ZOOM_connection_get_socket(co->link);
-}
-
-// Because ZOOM always knows what events it is interested in; we may not
-static int maskfun(IOCHAN c)
-{
- struct connection *co = iochan_getdata(c);
- if (!co->link)
- return 0;
-
- // This is cheating a little, and assuming that eventl mask IDs are always
- // the same as ZOOM-C's.
- return ZOOM_connection_get_mask(co->link);
-}
-
-static int connection_connect(struct connection *con)
-{
- ZOOM_connection link = 0;
- struct host *host = connection_get_host(con);