Mercurial > hg > th-libs
comparison th_network.c @ 104:ec5a5e573885
Return real error values.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 21 Jun 2014 05:59:29 +0300 |
parents | f7bec3f7181d |
children | ea5b1c4b3af5 |
comparison
equal
deleted
inserted
replaced
103:f7bec3f7181d | 104:ec5a5e573885 |
---|---|
147 | 147 |
148 | 148 |
149 int th_conn_set_proxy(th_conn_t *conn, int type, int port, const char *host, int auth_type) | 149 int th_conn_set_proxy(th_conn_t *conn, int type, int port, const char *host, int auth_type) |
150 { | 150 { |
151 if (conn == NULL) | 151 if (conn == NULL) |
152 return -1; | 152 return THERR_NULLPTR; |
153 | 153 |
154 conn->proxy.type = type; | 154 conn->proxy.type = type; |
155 conn->proxy.port = port; | 155 conn->proxy.port = port; |
156 conn->proxy.auth_type = auth_type; | 156 conn->proxy.auth_type = auth_type; |
157 | 157 |
162 { | 162 { |
163 conn->proxy.hst = th_resolve_host(conn, host); | 163 conn->proxy.hst = th_resolve_host(conn, host); |
164 th_get_addr(&(conn->proxy.addr), conn->proxy.hst); | 164 th_get_addr(&(conn->proxy.addr), conn->proxy.hst); |
165 } | 165 } |
166 else | 166 else |
167 return -2; | 167 return THERR_INVALID_DATA; |
168 | 168 |
169 return 0; | 169 return THERR_OK; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 int th_conn_set_proxy_auth_user(th_conn_t *conn, const char *userid, const char *passwd) | 173 int th_conn_set_proxy_auth_user(th_conn_t *conn, const char *userid, const char *passwd) |
174 { | 174 { |
175 if (conn == NULL) | 175 if (conn == NULL) |
176 return -1; | 176 return THERR_NULLPTR; |
177 | 177 |
178 th_free(conn->proxy.userid); | 178 th_free(conn->proxy.userid); |
179 conn->proxy.userid = th_strdup(userid); | 179 conn->proxy.userid = th_strdup(userid); |
180 | 180 |
181 th_free(conn->proxy.passwd); | 181 th_free(conn->proxy.passwd); |
182 conn->proxy.passwd = th_strdup(passwd); | 182 conn->proxy.passwd = th_strdup(passwd); |
183 | 183 |
184 return 0; | 184 return THERR_OK; |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 static BOOL th_conn_proxy_wait(th_conn_t *conn) | 188 static BOOL th_conn_proxy_wait(th_conn_t *conn) |
189 { | 189 { |