Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
e3120226
Commit
e3120226
authored
Nov 04, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1414 from FlamingTree/develop
bugfix: graceful failed when both enable http and https
parents
25bec8bb
f81929c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
app.go
app.go
+8
-5
No files found.
app.go
View file @
e3120226
...
...
@@ -89,6 +89,7 @@ func (app *App) Run() {
}
}
else
{
if
Graceful
{
httpsAddr
:=
addr
app
.
Server
.
Addr
=
addr
app
.
Server
.
Handler
=
app
.
Handlers
app
.
Server
.
ReadTimeout
=
time
.
Duration
(
HTTPServerTimeOut
)
*
time
.
Second
...
...
@@ -97,11 +98,12 @@ func (app *App) Run() {
go
func
()
{
time
.
Sleep
(
20
*
time
.
Microsecond
)
if
HTTPSPort
!=
0
{
a
ddr
=
fmt
.
Sprintf
(
"%s:%d"
,
HTTPAddr
,
HTTPSPort
)
app
.
Server
.
Addr
=
a
ddr
httpsA
ddr
=
fmt
.
Sprintf
(
"%s:%d"
,
HTTPAddr
,
HTTPSPort
)
app
.
Server
.
Addr
=
httpsA
ddr
}
server
:=
grace
.
NewServer
(
addr
,
app
.
Handlers
)
server
.
Server
=
app
.
Server
server
:=
grace
.
NewServer
(
httpsAddr
,
app
.
Handlers
)
server
.
Server
.
ReadTimeout
=
app
.
Server
.
ReadTimeout
server
.
Server
.
WriteTimeout
=
app
.
Server
.
WriteTimeout
err
:=
server
.
ListenAndServeTLS
(
HTTPCertFile
,
HTTPKeyFile
)
if
err
!=
nil
{
BeeLogger
.
Critical
(
"ListenAndServeTLS: "
,
err
,
fmt
.
Sprintf
(
"%d"
,
os
.
Getpid
()))
...
...
@@ -113,7 +115,8 @@ func (app *App) Run() {
if
EnableHTTPListen
{
go
func
()
{
server
:=
grace
.
NewServer
(
addr
,
app
.
Handlers
)
server
.
Server
=
app
.
Server
server
.
Server
.
ReadTimeout
=
app
.
Server
.
ReadTimeout
server
.
Server
.
WriteTimeout
=
app
.
Server
.
WriteTimeout
if
ListenTCP4
&&
HTTPAddr
==
""
{
server
.
Network
=
"tcp4"
}
...
...
Write
Preview
Markdown
is supported
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