summaryrefslogtreecommitdiffhomepage
path: root/src/nginext/nginext.go
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-08-30 11:50:33 -0700
committerMax Romanov <max.romanov@nginx.com>2017-08-30 11:50:33 -0700
commita33145d614e9ea1d0c59cf219f50e36f879aa5bb (patch)
tree17973a2f4cb4bde8b78e8ac9399bb9cddf740f20 /src/nginext/nginext.go
parent9537821f3f486f5176affc7d4f51328c23efd48f (diff)
downloadunit-a33145d614e9ea1d0c59cf219f50e36f879aa5bb.tar.gz
unit-a33145d614e9ea1d0c59cf219f50e36f879aa5bb.tar.bz2
ListenAndServe changed to be compatible with http.ListenAndServe.
Diffstat (limited to '')
-rw-r--r--src/nginext/nginext.go11
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
}