comparison network.c @ 458:6eef0dc83f0a

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 26 May 2012 05:33:06 +0300
parents bb65460c7aa2
children 8bd6bad09fb8
comparison
equal deleted inserted replaced
457:69ce77696c5d 458:6eef0dc83f0a
90 90
91 91
92 struct hostent *nn_resolve_host(nn_conn_t *conn, const char *name) 92 struct hostent *nn_resolve_host(nn_conn_t *conn, const char *name)
93 { 93 {
94 struct hostent *res = gethostbyname(name); 94 struct hostent *res = gethostbyname(name);
95
95 if (res == NULL) 96 if (res == NULL)
96 nn_conn_err(conn, "Could not resolve hostname '%s': %s\n", name, strerror(h_errno)); 97 nn_conn_err(conn, "Could not resolve hostname '%s': %s\n", name, strerror(h_errno));
97 else 98 else
98 nn_conn_msg(conn, "True hostname for %s is %s\n", name, res->h_name); 99 nn_conn_msg(conn, "True hostname for %s is %s\n", name, res->h_name);
99 100
114 conn->msgfunc = msgfunc; 115 conn->msgfunc = msgfunc;
115 116
116 return conn; 117 return conn;
117 } 118 }
118 119
120
119 static BOOL nn_get_addr(struct in_addr *addr, struct hostent *hst) 121 static BOOL nn_get_addr(struct in_addr *addr, struct hostent *hst)
120 { 122 {
121 if (hst != NULL) 123 if (hst != NULL)
122 { 124 {
123 *addr = *(struct in_addr *) (hst->h_addr); 125 *addr = *(struct in_addr *) (hst->h_addr);
127 { 129 {
128 addr->s_addr = 0; 130 addr->s_addr = 0;
129 return FALSE; 131 return FALSE;
130 } 132 }
131 } 133 }
134
132 135
133 int nn_conn_set_proxy(nn_conn_t *conn, int type, int port, const char *host) 136 int nn_conn_set_proxy(nn_conn_t *conn, int type, int port, const char *host)
134 { 137 {
135 if (conn == NULL) 138 if (conn == NULL)
136 return -1; 139 return -1;
147 else 150 else
148 return -2; 151 return -2;
149 152
150 return 0; 153 return 0;
151 } 154 }
155
152 156
153 int nn_conn_open(nn_conn_t *conn, const int port, const char *host) 157 int nn_conn_open(nn_conn_t *conn, const int port, const char *host)
154 { 158 {
155 struct sockaddr_in dest; 159 struct sockaddr_in dest;
156 static const char *userid = "James Bond"; 160 static const char *userid = "James Bond";