mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-14 15:11:18 +08:00
Merge b6d89bc972c3e7a1c2e0bc73e552932bbbcec182 into 0397e5e0c0f8f8176c29f7edd8f1bff8e45df780
This commit is contained in:
commit
b1cca7a09f
9
gin.go
9
gin.go
@ -14,6 +14,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/gin-gonic/gin/internal/bytesconv"
|
||||||
"github.com/gin-gonic/gin/render"
|
"github.com/gin-gonic/gin/render"
|
||||||
@ -396,7 +397,13 @@ func (engine *Engine) Run(addr ...string) (err error) {
|
|||||||
|
|
||||||
address := resolveAddress(addr)
|
address := resolveAddress(addr)
|
||||||
debugPrint("Listening and serving HTTP on %s\n", address)
|
debugPrint("Listening and serving HTTP on %s\n", address)
|
||||||
err = http.ListenAndServe(address, engine.Handler())
|
|
||||||
|
server := &http.Server{
|
||||||
|
Addr: address,
|
||||||
|
Handler: engine.Handler(),
|
||||||
|
ReadTimeout: 60 * time.Second,
|
||||||
|
}
|
||||||
|
err = server.ListenAndServe()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user