Mercurial > hg > quicktun
comparison src/common.c @ 2:b2c7c83a1dda
Accept 0.0.0.0 remote address for float mode
author | ivo <ivo@UFO-Net.nl> |
---|---|
date | Thu, 07 Oct 2010 16:01:41 +0200 |
parents | 65c01f57bdce |
children | 27632fe319bd |
comparison
equal
deleted
inserted
replaced
1:06be0fd16c60 | 2:b2c7c83a1dda |
---|---|
114 he = gethostbyname(envval); | 114 he = gethostbyname(envval); |
115 if (!he) return errorexit("remote address lookup failed"); | 115 if (!he) return errorexit("remote address lookup failed"); |
116 else if (!he->h_addr_list[0]) return errorexit("no address to connect to"); | 116 else if (!he->h_addr_list[0]) return errorexit("no address to connect to"); |
117 udpaddr.sin_family = he->h_addrtype; | 117 udpaddr.sin_family = he->h_addrtype; |
118 udpaddr.sin_addr.s_addr = *((unsigned long*)he->h_addr_list[0]); | 118 udpaddr.sin_addr.s_addr = *((unsigned long*)he->h_addr_list[0]); |
119 if (envval = getconf("REMOTE_PORT")) { | 119 if (udpaddr.sin_addr.s_addr == 0) { |
120 udpaddr.sin_port = htons(atoi(envval)); | 120 session->remote_float = 1; |
121 } else { | |
122 if (envval = getconf("REMOTE_PORT")) { | |
123 udpaddr.sin_port = htons(atoi(envval)); | |
124 } | |
125 if (connect(sfd, (struct sockaddr*)&udpaddr, sizeof(struct sockaddr_in))) return errorexitp("Could not connect socket"); | |
126 session->remote_addr = udpaddr; | |
121 } | 127 } |
122 if (connect(sfd, (struct sockaddr*)&udpaddr, sizeof(struct sockaddr_in))) return errorexitp("Could not connect socket"); | |
123 session->remote_addr = udpaddr; | |
124 } | 128 } |
125 session->fd_socket = sfd; | 129 session->fd_socket = sfd; |
126 return sfd; | 130 return sfd; |
127 } | 131 } |
128 | 132 |