Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoradio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
autoradio
Commits
a04083e1
Commit
a04083e1
authored
5 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Reset the timeout on upstream connection after writing the request
parent
f377f90c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
node/bindata.go
+2
-2
2 additions, 2 deletions
node/bindata.go
node/proxy.go
+4
-1
4 additions, 1 deletion
node/proxy.go
node/proxy_test.go
+2
-2
2 additions, 2 deletions
node/proxy_test.go
with
8 additions
and
5 deletions
node/bindata.go
+
2
−
2
View file @
a04083e1
...
...
@@ -552,7 +552,7 @@ var _templatesIndexHtml = []byte(`<!DOCTYPE html>
<div class="row">
<p>
<small>
Click on a stream to listen to it.
<br>
Click on a stream to listen to it.
Hover on a stream to see more details.
</small>
</p>
...
...
@@ -583,7 +583,7 @@ func templatesIndexHtml() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "templates/index.html", size: 296
8
, mode: os.FileMode(420), modTime: time.Unix(158
1689120
, 0)}
info := bindataFileInfo{name: "templates/index.html", size: 296
4
, mode: os.FileMode(420), modTime: time.Unix(158
2995315
, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
...
...
This diff is collapsed.
Click to expand it.
node/proxy.go
+
4
−
1
View file @
a04083e1
...
...
@@ -112,14 +112,17 @@ func doIcecastProxy(rw http.ResponseWriter, req *http.Request, target *url.URL,
return
}
defer
upstream
.
Close
()
upstream
.
SetDeadline
(
time
.
Now
()
.
Add
(
requestWriteTimeout
))
// nolint: errcheck
// Send the request upstream, with a timeout so we don't get
// stuck on unresponsive TCP servers.
upstream
.
SetDeadline
(
time
.
Now
()
.
Add
(
requestWriteTimeout
))
// nolint: errcheck
if
err
:=
outreq
.
Write
(
upstream
);
err
!=
nil
{
log
.
Printf
(
"http: proxy request write error: %v"
,
err
)
rw
.
WriteHeader
(
http
.
StatusInternalServerError
)
proxyConnectErrs
.
WithLabelValues
(
streamName
,
target
.
Host
)
.
Inc
()
return
}
upstream
.
SetDeadline
(
time
.
Time
{})
// nolint: errcheck
// Hijack the request connection. We might need to unroll the
// layers of nested WrappedWriters, until we find a
...
...
This diff is collapsed.
Click to expand it.
node/proxy_test.go
+
2
−
2
View file @
a04083e1
...
...
@@ -114,8 +114,8 @@ func TestProxy(t *testing.T) {
}()
}
// Now wait
1
0 seconds.
time
.
Sleep
(
1
0
*
time
.
Second
)
// Now wait
3
0 seconds
, longer than request timeouts
.
time
.
Sleep
(
3
0
*
time
.
Second
)
stopProxyTest
()
for
i
:=
0
;
i
<
streams
;
i
++
{
...
...
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
register
or
sign in
to comment