Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Collector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Automate
Agent sessions
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
Legacy
gitolite
user
iwakeh
Collector
Commits
78c77275
Commit
78c77275
authored
Jul 6, 2017
by
iwakeh
Browse files
Options
Downloads
Patches
Plain Diff
Set read timeout on HTTPUrlConnection and some minor tweaks.
Implements task20516.
parent
1694a883
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
+16
-16
16 additions, 16 deletions
...rg/torproject/collector/exitlists/ExitListDownloader.java
with
16 additions
and
16 deletions
src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
+
16
−
16
View file @
78c77275
...
...
@@ -71,30 +71,30 @@ public class ExitListDownloader extends CollecTorMain {
EXITLISTS
).
toString
();
Date
downloadedDate
=
new
Date
();
String
downloadedExitList
=
null
;
try
{
logger
.
debug
(
"Downloading exit list..."
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
Annotation
.
ExitList
.
toString
());
sb
.
append
(
"Downloaded "
+
dateTimeFormat
.
format
(
downloadedDate
)
+
"\n"
);
sb
.
append
(
"Downloaded "
+
dateTimeFormat
.
format
(
downloadedDate
)
+
"\n"
);
URL
url
=
config
.
getUrl
(
Key
.
ExitlistUrl
);
try
{
HttpURLConnection
huc
=
(
HttpURLConnection
)
url
.
openConnection
();
huc
.
setRequestMethod
(
"GET"
);
huc
.
setReadTimeout
(
5000
);
huc
.
connect
();
int
response
=
huc
.
getResponseCode
();
if
(
response
!=
200
)
{
logger
.
warn
(
"Could not download exit list. Response code
"
+
response
);
logger
.
warn
(
"Could not download exit list. Response code
{}"
,
response
);
return
;
}
BufferedInputStream
in
=
new
BufferedInputStream
(
huc
.
getInputStream
())
;
try
(
BufferedInputStream
in
=
new
BufferedInputStream
(
huc
.
getInputStream
())
)
{
int
len
;
byte
[]
data
=
new
byte
[
1024
];
while
((
len
=
in
.
read
(
data
,
0
,
1024
))
>=
0
)
{
sb
.
append
(
new
String
(
data
,
0
,
len
));
}
in
.
close
();
}
downloadedExitList
=
sb
.
toString
();
logger
.
debug
(
"Finished downloading exit list."
);
}
catch
(
IOException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment