aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cottrell <iancottrell@google.com>2015-04-15 15:31:00 +0100
committerIan Cottrell <iancottrell@google.com>2015-04-15 15:31:00 +0100
commit9b6744a45d206a7410da1d6481d9edbbf154a7bb (patch)
tree27a58239df2f14f7f91274c3bf2837a4bd363098
parent86e555ce5c4166cb11f09de4152bddf575800fb3 (diff)
downloadgpu-9b6744a45d206a7410da1d6481d9edbbf154a7bb.tar.gz
Default server binds to loopback address and allow it to be specified on the command line
Change-Id: I60c03766c15d582e5765da8e59e4b227e817c21a
-rw-r--r--server/gapis/main.go8
-rw-r--r--server/server.go8
2 files changed, 8 insertions, 8 deletions
diff --git a/server/gapis/main.go b/server/gapis/main.go
index fc1c508c6..6685eb905 100644
--- a/server/gapis/main.go
+++ b/server/gapis/main.go
@@ -28,8 +28,8 @@ import (
import _ "android.googlesource.com/platform/tools/gpu/gfxapi/all"
var (
- httpPort = flag.Int("httpPort", 8080, "TCP port of the server's HTTP listener")
- rpcPort = flag.Int("rpcPort", 6700, "TCP port of the server's RPC listener")
+ http = flag.String("http", "localhost:8080", "TCP host:port of the server's HTTP listener")
+ rpc = flag.String("rpc", "localhost:6700", "TCP host:port of the server's RPC listener")
dataPath = flag.String("data", "data", "Path to the server's data folder")
logfilePath = flag.String("logfile", filepath.Join("logs", "server.log"), "Path to the server's logfile")
)
@@ -47,8 +47,8 @@ func main() {
logfileAbsPath, _ := filepath.Abs(*logfilePath)
server.Run(server.Config{
- HttpPort: *httpPort,
- RpcPort: *rpcPort,
+ HttpAddress: *http,
+ RpcAddress: *rpc,
DataPath: dataAbsPath,
LogfilePath: logfileAbsPath,
}, nil)
diff --git a/server/server.go b/server/server.go
index 87ea58e99..2ca90eacb 100644
--- a/server/server.go
+++ b/server/server.go
@@ -28,8 +28,8 @@ import (
)
type Config struct {
- HttpPort int
- RpcPort int
+ HttpAddress string
+ RpcAddress string
DataPath string
LogfilePath string
}
@@ -67,7 +67,7 @@ func Run(config Config, rpcReady chan<- struct{}) {
Database: database,
ReplayManager: replayManager,
}
- go rpc.ListenAndServe(fmt.Sprintf(":%d", config.RpcPort), mtu, logger)
+ go rpc.ListenAndServe(config.RpcAddress, mtu, logger)
// If provided, tell the caller chan that the RPC listener is ready.
if nil != rpcReady {
@@ -77,5 +77,5 @@ func Run(config Config, rpcReady chan<- struct{}) {
// Setup and run the (blocking) HTTP listener.
http.Handle(atomsRoute, http.StripPrefix(atomsRoute, atomsHandler{database}))
http.Handle(schemaRoute, http.StripPrefix(schemaRoute, http.HandlerFunc(schemaHandler)))
- http.ListenAndServe(fmt.Sprintf(":%d", config.HttpPort), nil)
+ http.ListenAndServe(config.HttpAddress, nil)
}