+
+static void
+cb_Connect_to_Server(int fd, UNUSED short events)
+{
+ /* Read result of resolver sub-process from pipe and start connection */
+ int i;
+ size_t len;
+ struct in_addr dest_addr;
+ char readbuf[HOST_LEN + 1];
+
+ LogDebug("Resolver: Got forward lookup callback on fd %d, events %d", fd, events);
+
+ for (i=0; i < MAX_SERVERS; i++) {
+ if (Resolve_Getfd(&Conf_Server[i].res_stat) == fd )
+ break;
+ }
+
+ if( i >= MAX_SERVERS) {
+ /* Ops, no matching server found?! */
+ io_close( fd );
+ LogDebug("Resolver: Got Forward Lookup callback for unknown server!?");
+ return;
+ }
+
+ /* Read result from pipe */
+ len = Resolve_Read(&Conf_Server[i].res_stat, readbuf, sizeof(readbuf)-1);
+ if (len == 0)
+ return;
+
+ readbuf[len] = '\0';
+ LogDebug("Got result from resolver: \"%s\" (%u bytes read).", readbuf, len);
+
+ if (!ngt_IPStrToBin(readbuf, &dest_addr)) {
+ Log(LOG_ERR, "Can't connect to \"%s\": can't convert ip address %s!",
+ Conf_Server[i].host, readbuf);
+ return;
+ }
+
+ Log( LOG_INFO, "Establishing connection to \"%s\", %s, port %d ... ",
+ Conf_Server[i].host, readbuf, Conf_Server[i].port );
+ /* connect() */
+ New_Server(i, &dest_addr);
+} /* cb_Read_Forward_Lookup */
+
+
+static void
+cb_Read_Resolver_Result( int r_fd, UNUSED short events )