Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
b2fbd834
Commit
b2fbd834
authored
Jan 28, 2005
by
Roger Dingledine
Browse files
forward-port the dns and maxconn fixes
svn:r3448
parent
d7cee9db
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
b2fbd834
...
...
@@ -1328,8 +1328,8 @@ options_validate(or_options_t *options)
result
=
-
1
;
}
if
(
options
->
MaxConn
>
=
MAXCONNECTIONS
)
{
log
(
LOG_WARN
,
"MaxConn option must be
less than
%d."
,
MAXCONNECTIONS
);
if
(
options
->
MaxConn
>
MAXCONNECTIONS
)
{
log
(
LOG_WARN
,
"MaxConn option must be
at most
%d."
,
MAXCONNECTIONS
);
result
=
-
1
;
}
...
...
src/or/connection_edge.c
View file @
b2fbd834
...
...
@@ -842,7 +842,10 @@ int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
return
0
;
case
-
1
:
/* resolve failed */
log_fn
(
LOG_INFO
,
"Resolve failed (%s)."
,
n_stream
->
address
);
connection_edge_end
(
n_stream
,
END_STREAM_REASON_RESOLVEFAILED
,
n_stream
->
cpath_layer
);
if
(
!
n_stream
->
marked_for_close
)
{
connection_edge_end
(
n_stream
,
END_STREAM_REASON_RESOLVEFAILED
,
n_stream
->
cpath_layer
);
}
connection_free
(
n_stream
);
break
;
case
0
:
/* resolve added to pending list */
...
...
src/or/dns.c
View file @
b2fbd834
...
...
@@ -280,8 +280,9 @@ static int assign_to_dnsworker(connection_t *exitconn) {
if
(
!
dnsconn
)
{
log_fn
(
LOG_WARN
,
"no idle dns workers. Failing."
);
dns_cancel_pending_resolve
(
exitconn
->
address
);
send_resolved_cell
(
exitconn
,
RESOLVED_TYPE_ERROR_TRANSIENT
);
if
(
exitconn
->
purpose
==
EXIT_PURPOSE_RESOLVE
)
send_resolved_cell
(
exitconn
,
RESOLVED_TYPE_ERROR_TRANSIENT
);
dns_cancel_pending_resolve
(
exitconn
->
address
);
/* also sends end */
return
-
1
;
}
...
...
@@ -387,6 +388,7 @@ void dns_cancel_pending_resolve(char *address) {
struct
cached_resolve
search
;
struct
cached_resolve
*
resolve
;
connection_t
*
pendconn
;
circuit_t
*
circ
;
strlcpy
(
search
.
address
,
address
,
sizeof
(
search
.
address
));
...
...
@@ -412,9 +414,12 @@ void dns_cancel_pending_resolve(char *address) {
pendconn
=
pend
->
conn
;
tor_assert
(
pendconn
->
s
==
-
1
);
if
(
!
pendconn
->
marked_for_close
)
{
connection_edge_end
(
pendconn
,
END_STREAM_REASON_MISC
,
pendconn
->
cpath_layer
);
connection_edge_end
(
pendconn
,
END_STREAM_REASON_RESOURCELIMIT
,
pendconn
->
cpath_layer
);
}
circuit_detach_stream
(
circuit_get_by_conn
(
pendconn
),
pendconn
);
circ
=
circuit_get_by_conn
(
pendconn
);
if
(
circ
)
circuit_detach_stream
(
circ
,
pendconn
);
connection_free
(
pendconn
);
resolve
->
pending_connections
=
pend
->
next
;
tor_free
(
pend
);
...
...
src/or/main.c
View file @
b2fbd834
...
...
@@ -65,7 +65,7 @@ static time_t time_to_fetch_running_routers = 0;
/** Array of all open connections; each element corresponds to the element of
* poll_array in the same position. The first nfds elements are valid. */
static
connection_t
*
connection_array
[
MAXCONNECTIONS
]
=
static
connection_t
*
connection_array
[
MAXCONNECTIONS
+
1
]
=
{
NULL
};
static
smartlist_t
*
closeable_connection_lst
=
NULL
;
...
...
@@ -115,7 +115,7 @@ int connection_add(connection_t *conn) {
tor_assert
(
conn
->
s
>=
0
);
if
(
nfds
>=
get_options
()
->
MaxConn
-
1
)
{
log_fn
(
LOG_WARN
,
"
f
ailing because
nfds is too high."
);
log_fn
(
LOG_WARN
,
"
F
ailing because
we have %d connections already. Please set MaxConn higher."
,
nfds
);
return
-
1
;
}
...
...
src/or/or.h
View file @
b2fbd834
...
...
@@ -130,7 +130,7 @@
/** Upper bound on maximum simultaneous connections; can be lowered by
* config file. */
#define MAXCONNECTIONS 1
0
000
#define MAXCONNECTIONS 1
5
000
#define DEFAULT_BANDWIDTH_OP (1024 * 1000)
#define MAX_NICKNAME_LEN 19
...
...
@@ -401,7 +401,8 @@ typedef enum {
#define END_STREAM_REASON_DESTROY 5
#define END_STREAM_REASON_DONE 6
#define END_STREAM_REASON_TIMEOUT 7
#define _MAX_END_STREAM_REASON 7
#define END_STREAM_REASON_RESOURCELIMIT 8
#define _MAX_END_STREAM_REASON 8
#define RESOLVED_TYPE_IPV4 4
#define RESOLVED_TYPE_IPV6 6
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment