aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-19 23:26:21 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-19 23:26:21 +0000
commita5ff0527e6a815d1de09039c59c1c6ac2392fd54 (patch)
tree8330ffc4c9ad5541bab7e6a52afe1e712093b03c /src/or/connection.c
parentf9a04097146f72fd24abb5ee5d95c485b3c767d0 (diff)
downloadtor-a5ff0527e6a815d1de09039c59c1c6ac2392fd54.tar
tor-a5ff0527e6a815d1de09039c59c1c6ac2392fd54.tar.gz
it turns out we weren't looking at the result from getsockopt().
now we do. but i'm not sure it matters, since we also poll for reads, and if there's an error with the connecting socket, poll is supposed to return readable, so we should notice it then. who knows. svn:r2057
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 4b06f7369..c95b412a5 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -834,9 +834,18 @@ int connection_handle_write(connection_t *conn) {
/* Sometimes, "writeable" means "connected". */
if (connection_state_is_connecting(conn)) {
if (getsockopt(conn->s, SOL_SOCKET, SO_ERROR, (void*)&e, &len) < 0) {
- /* not yet */
+ log_fn(LOG_WARN,"getsockopt() syscall failed?! Please report to tor-ops.");
+ connection_close_immediate(conn);
+ connection_mark_for_close(conn);
+ return -1;
+ }
+ if(e) {
+ /* some sort of error, but maybe just inprogress still */
+ errno = e; /* XXX008 this is a kludge. maybe we should rearrange
+ our error-hunting functions? E.g. pass errno to
+ tor_socket_errno(). */
if(!ERRNO_IS_CONN_EINPROGRESS(tor_socket_errno(conn->s))) {
- log_fn(LOG_DEBUG,"in-progress connect failed. Removing.");
+ log_fn(LOG_INFO,"in-progress connect failed. Removing.");
connection_close_immediate(conn);
connection_mark_for_close(conn);
/* it's safe to pass OPs to router_mark_as_down(), since it just