diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-08-30 11:50:33 -0700 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-08-30 11:50:33 -0700 |
commit | a33145d614e9ea1d0c59cf219f50e36f879aa5bb (patch) | |
tree | 17973a2f4cb4bde8b78e8ac9399bb9cddf740f20 /src/nginext/nginext.go | |
parent | 9537821f3f486f5176affc7d4f51328c23efd48f (diff) | |
download | unit-a33145d614e9ea1d0c59cf219f50e36f879aa5bb.tar.gz unit-a33145d614e9ea1d0c59cf219f50e36f879aa5bb.tar.bz2 |
ListenAndServe changed to be compatible with http.ListenAndServe.
Diffstat (limited to '')
-rw-r--r-- | src/nginext/nginext.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/nginext/nginext.go b/src/nginext/nginext.go index de0218e8..895d6b28 100644 --- a/src/nginext/nginext.go +++ b/src/nginext/nginext.go @@ -12,6 +12,7 @@ import "C" import ( "fmt" + "net/http" "os" "strconv" "strings" @@ -80,7 +81,7 @@ func nxt_go_set_quit() { nxt_go_quit = true } -func ListenAndServe() { +func ListenAndServe(addr string, handler http.Handler) error { var read_port *port go_ports_env := os.Getenv("NXT_GO_PORTS") @@ -120,8 +121,14 @@ func ListenAndServe() { C.nxt_go_ready() for !nxt_go_quit { - read_port.read() + err := read_port.read(handler) + if err != nil { + return err + } } + } else { + return http.ListenAndServe(addr, handler) } + return nil } |