ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/sockinfo.C
(Generate patch)

Comparing gvpe/src/sockinfo.C (file contents):
Revision 1.2 by pcg, Wed Apr 2 03:25:17 2003 UTC vs.
Revision 1.3 by pcg, Wed Apr 2 05:15:00 2003 UTC

32 port = prot_ == PROT_IPv4 ? 0 : sa->sin_port; 32 port = prot_ == PROT_IPv4 ? 0 : sa->sin_port;
33 prot = prot_; 33 prot = prot_;
34} 34}
35 35
36void 36void
37sockinfo::set (const conf_node *conf) 37sockinfo::set (const conf_node *conf, u8 prot_)
38{ 38{
39 prot = prot_;
39 host = 0; 40 host = 0;
40 port = htons (conf->udp_port); 41 port = prot_ == PROT_UDPv4 ? htons (conf->udp_port)
42 : prot_ == PROT_TCPv4 ? htons (conf->tcp_port)
43 : 0;
41 44
42 if (conf->hostname) 45 if (conf->hostname)
43 { 46 {
44 struct hostent *he = gethostbyname (conf->hostname); 47 struct hostent *he = gethostbyname (conf->hostname);
45 48
47 && he->h_addrtype == AF_INET && he->h_length == 4 && he->h_addr_list[0]) 50 && he->h_addrtype == AF_INET && he->h_length == 4 && he->h_addr_list[0])
48 { 51 {
49 //sa->sin_family = he->h_addrtype; 52 //sa->sin_family = he->h_addrtype;
50 memcpy (&host, he->h_addr_list[0], 4); 53 memcpy (&host, he->h_addr_list[0], 4);
51 54
52 prot = PROT_UDPv4 | PROT_IPv4;
53 } 55 }
54 else 56 else
55 slog (L_NOTICE, _("unable to resolve host '%s'"), conf->hostname); 57 slog (L_NOTICE, _("unable to resolve host '%s'"), conf->hostname);
56 } 58 }
57} 59}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines