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
bf9de3bc
Commit
bf9de3bc
authored
Jul 03, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add HttpServerTimeOut setting
parent
189df128
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
beego.go
beego.go
+10
-1
config.go
config.go
+3
-0
No files found.
beego.go
View file @
bf9de3bc
...
...
@@ -10,6 +10,7 @@ import (
"os"
"path"
"runtime"
"time"
)
const
VERSION
=
"0.7.0"
...
...
@@ -41,6 +42,7 @@ var (
EnableGzip
bool
// enable gzip
DirectoryIndex
bool
//ebable DirectoryIndex default is false
EnbaleHotUpdate
bool
//enable HotUpdate default is false
HttpServerTimeOut
int64
)
func
init
()
{
...
...
@@ -67,6 +69,7 @@ func init() {
EnableGzip
=
false
StaticDir
[
"/static"
]
=
"static"
AppConfigPath
=
path
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
HttpServerTimeOut
=
0
ParseConfig
()
}
...
...
@@ -106,7 +109,13 @@ func (app *App) Run() {
theStoppable
.
wg
.
Wait
()
CloseSelf
()
}
else
{
err
=
http
.
ListenAndServe
(
addr
,
app
.
Handlers
)
s
:=
&
http
.
Server
{
Addr
:
addr
,
Handler
:
app
.
Handlers
,
ReadTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
WriteTimeout
:
time
.
Duration
(
HttpServerTimeOut
)
*
time
.
Second
,
}
err
=
s
.
ListenAndServe
()
}
}
...
...
config.go
View file @
bf9de3bc
...
...
@@ -180,6 +180,9 @@ func ParseConfig() (err error) {
if
hotupdate
,
err
:=
AppConfig
.
Bool
(
"hotupdate"
);
err
==
nil
{
EnbaleHotUpdate
=
hotupdate
}
if
timeout
,
err
:=
AppConfig
.
Int64
(
"httpservertimeout"
);
err
==
nil
{
HttpServerTimeOut
=
timeout
}
}
return
nil
}
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