ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/s_bsd.c
(Generate patch)

Comparing ircd-hybrid-7.2/src/s_bsd.c (file contents):
Revision 991 by michael, Sun Aug 2 18:05:28 2009 UTC vs.
Revision 992 by michael, Mon Aug 17 19:19:16 2009 UTC

# Line 62 | Line 62 | struct Callback *setup_socket_cb = NULL;
62  
63   static void comm_connect_callback(fde_t *fd, int status);
64   static PF comm_connect_timeout;
65 < static void comm_connect_dns_callback(void *vptr, struct DNSReply *reply);
65 > static void comm_connect_dns_callback(void *, const struct irc_ssaddr *, const char *);
66   static PF comm_connect_tryconnect;
67  
68  
# Line 507 | Line 507 | comm_connect_tcp(fde_t *fd, const char *
507                   void *data, int aftype, int timeout)
508   {
509    struct addrinfo hints, *res;
510 <  char portname[PORTNAMELEN+1];
510 >  char portname[PORTNAMELEN + 1];
511  
512    assert(callback);
513    fd->connect.callback = callback;
# Line 539 | Line 539 | comm_connect_tcp(fde_t *fd, const char *
539    hints.ai_socktype = SOCK_STREAM;
540    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
541  
542 <  snprintf(portname, PORTNAMELEN, "%d", port);
542 >  snprintf(portname, sizeof(portname), "%d", port);
543  
544    if (irc_getaddrinfo(host, portname, &hints, &res))
545    {
546      /* Send the DNS request, for the next level */
547    fd->dns_query = MyMalloc(sizeof(struct DNSQuery));
548    fd->dns_query->ptr = fd;
549    fd->dns_query->callback = comm_connect_dns_callback;
547      if (aftype == AF_INET6)
548 <      gethost_byname_type(host, fd->dns_query, T_AAAA);
548 >      gethost_byname_type(comm_connect_dns_callback, fd, host, T_AAAA);
549      else
550 <      gethost_byname_type(host, fd->dns_query, T_A);
550 >      gethost_byname_type(comm_connect_dns_callback, fd, host, T_A);
551    }
552    else
553    {
# Line 608 | Line 605 | comm_connect_timeout(fde_t *fd, void *no
605   * otherwise we initiate the connect()
606   */
607   static void
608 < comm_connect_dns_callback(void *vptr, struct DNSReply *reply)
608 > comm_connect_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
609   {
610    fde_t *F = vptr;
611  
612 <  if (reply == NULL)
612 >  if (name == NULL)
613    {
617    MyFree(F->dns_query);
618    F->dns_query = NULL;
614      comm_connect_callback(F, COMM_ERR_DNS);
615      return;
616    }
# Line 629 | Line 624 | comm_connect_dns_callback(void *vptr, st
624     * the DNS record around, and the DNS cache is gone anyway..
625     *     -- adrian
626     */
627 <  memcpy(&F->connect.hostaddr, &reply->addr, reply->addr.ss_len);
627 >  memcpy(&F->connect.hostaddr, addr, addr->ss_len);
628    /* The cast is hacky, but safe - port offset is same on v4 and v6 */
629    ((struct sockaddr_in *) &F->connect.hostaddr)->sin_port =
630      F->connect.hostaddr.ss_port;
631 <  F->connect.hostaddr.ss_len = reply->addr.ss_len;
631 >  F->connect.hostaddr.ss_len = addr->ss_len;
632  
633    /* Now, call the tryconnect() routine to try a connect() */
639  MyFree(F->dns_query);
640  F->dns_query = NULL;
634    comm_connect_tryconnect(F, NULL);
635   }
636  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)