[or-cvs] r10541: Arg. Irix apparently #defines sa_family to something. Thus, (in tor/trunk: . src/or)
nickm at seul.org
nickm at seul.org
Fri Jun 8 21:14:58 UTC 2007
Author: nickm
Date: 2007-06-08 17:14:58 -0400 (Fri, 08 Jun 2007)
New Revision: 10541
Modified:
tor/trunk/
tor/trunk/src/or/connection.c
tor/trunk/src/or/or.h
Log:
r13328 at catbus: nickm | 2007-06-08 17:14:55 -0400
Arg. Irix apparently #defines sa_family to something. Thus, naming fields or variables "sa_family" will not work.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13328] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2007-06-08 19:02:39 UTC (rev 10540)
+++ tor/trunk/src/or/connection.c 2007-06-08 21:14:58 UTC (rev 10541)
@@ -157,7 +157,7 @@
* Initialize conn's timestamps to now.
*/
connection_t *
-connection_new(int type, int sa_family)
+connection_new(int type, int socket_family)
{
static uint32_t n_connections_allocated = 1;
connection_t *conn;
@@ -195,7 +195,7 @@
conn->conn_array_index = -1; /* also default to 'not used' */
conn->type = type;
- conn->sa_family = sa_family;
+ conn->socket_family = socket_family;
if (!connection_is_listener(conn)) { /* listeners never use their buf */
conn->inbuf = buf_new();
conn->outbuf = buf_new();
@@ -296,7 +296,7 @@
buf_free(conn->inbuf);
buf_free(conn->outbuf);
} else {
- if (conn->sa_family == AF_UNIX) {
+ if (conn->socket_family == AF_UNIX) {
/* For now only control ports can be unix domain sockets
* and listeners at the same time */
tor_assert(conn->type == CONN_TYPE_CONTROL_LISTENER);
@@ -830,7 +830,7 @@
set_socket_nonblocking(s);
conn = connection_new(type, listensockaddr->sa_family);
- conn->sa_family = listensockaddr->sa_family;
+ conn->socket_family = listensockaddr->sa_family;
conn->s = s;
conn->address = tor_strdup(address);
conn->port = usePort;
@@ -923,9 +923,9 @@
set_socket_nonblocking(news);
- tor_assert(((struct sockaddr*)addrbuf)->sa_family == conn->sa_family);
+ tor_assert(((struct sockaddr*)addrbuf)->sa_family == conn->socket_family);
- if (conn->sa_family == AF_INET) {
+ if (conn->socket_family == AF_INET) {
if (check_sockaddr_in((struct sockaddr*)addrbuf, remotelen, LOG_INFO)<0) {
log_info(LD_NET,
"accept() returned a strange address; trying getsockname().");
@@ -969,7 +969,7 @@
}
}
- newconn = connection_new(new_type, conn->sa_family);
+ newconn = connection_new(new_type, conn->socket_family);
newconn->s = news;
/* remember the remote address */
@@ -977,12 +977,12 @@
newconn->port = ntohs(remote.sin_port);
newconn->address = tor_dup_addr(newconn->addr);
- } else if (conn->sa_family == AF_UNIX) {
+ } else if (conn->socket_family == AF_UNIX) {
/* For now only control ports can be unix domain sockets
* and listeners at the same time */
tor_assert(conn->type == CONN_TYPE_CONTROL_LISTENER);
- newconn = connection_new(new_type, conn->sa_family);
+ newconn = connection_new(new_type, conn->socket_family);
newconn->s = news;
/* remember the remote address -- do we have anything sane to put here? */
@@ -1150,7 +1150,7 @@
smartlist_t *replaced_conns,
smartlist_t *new_conns,
int never_open_conns,
- int sa_family)
+ int socket_family)
{
smartlist_t *launch = smartlist_create(), *conns;
int free_launch_elts = 1;
@@ -1159,7 +1159,7 @@
connection_t *conn;
config_line_t *line;
- tor_assert(sa_family == AF_INET || sa_family == AF_UNIX);
+ tor_assert(socket_family == AF_INET || socket_family == AF_UNIX);
if (cfg && port_option) {
for (c = cfg; c; c = c->next) {
@@ -1182,7 +1182,7 @@
SMARTLIST_FOREACH(conns, connection_t *, conn,
{
if (conn->type != type ||
- conn->sa_family != sa_family ||
+ conn->socket_family != socket_family ||
conn->marked_for_close)
continue;
/* Okay, so this is a listener. Is it configured? */
@@ -1191,7 +1191,7 @@
{
char *address=NULL;
uint16_t port;
- switch (sa_family) {
+ switch (socket_family) {
case AF_INET:
if (!parse_addr_port(LOG_WARN,
wanted->value, &address, NULL, &port)) {
@@ -1243,7 +1243,7 @@
char *address = NULL;
struct sockaddr *listensockaddr;
- switch (sa_family) {
+ switch (socket_family) {
case AF_INET:
listensockaddr = (struct sockaddr *)
create_inet_sockaddr(cfg_line->value,
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-06-08 19:02:39 UTC (rev 10540)
+++ tor/trunk/src/or/or.h 2007-06-08 21:14:58 UTC (rev 10541)
@@ -786,9 +786,9 @@
time_t timestamp_created; /**< When was this connection_t created? */
/* XXXX020 make this ipv6-capable */
- int sa_family; /**< Address family of this connection's socket. Usually
- * AF_INET, but it can also be AF_UNIX, or in the future
- * AF_INET6 */
+ int socket_family; /**< Address family of this connection's socket. Usually
+ * AF_INET, but it can also be AF_UNIX, or in the future
+ * AF_INET6 */
uint32_t addr; /**< IP of the other side of the connection; used to identify
* routers, along with port. */
uint16_t port; /**< If non-zero, port on the other end
@@ -2347,7 +2347,7 @@
const char *conn_type_to_string(int type);
const char *conn_state_to_string(int type, int state);
-connection_t *connection_new(int type, int sa_family);
+connection_t *connection_new(int type, int socket_family);
void connection_link_connections(connection_t *conn_a, connection_t *conn_b);
void connection_unregister_events(connection_t *conn);
void connection_free(connection_t *conn);
More information about the tor-commits
mailing list