Commit c668b44c authored by alexstocks's avatar alexstocks

use goext

parent 30608160
...@@ -26,6 +26,8 @@ import ( ...@@ -26,6 +26,8 @@ import (
import ( import (
"github.com/AlexStocks/getty" "github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor" "github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/net"
"github.com/AlexStocks/goext/time"
log "github.com/AlexStocks/log4go" log "github.com/AlexStocks/log4go"
) )
...@@ -60,7 +62,7 @@ func initProfiling() { ...@@ -60,7 +62,7 @@ func initProfiling() {
addr string addr string
) )
addr = getty.HostAddress(conf.LocalHost, conf.ProfilePort) addr = gxnet.HostAddress(conf.LocalHost, conf.ProfilePort)
log.Info("App Profiling startup on address{%v}", addr+pprofPath) log.Info("App Profiling startup on address{%v}", addr+pprofPath)
go func() { go func() {
log.Info(http.ListenAndServe(addr, nil)) log.Info(http.ListenAndServe(addr, nil))
...@@ -100,7 +102,7 @@ func initClient() { ...@@ -100,7 +102,7 @@ func initClient() {
client.gettyClient = getty.NewClient( client.gettyClient = getty.NewClient(
(int)(conf.ConnectionNum), (int)(conf.ConnectionNum),
conf.connectInterval, conf.connectInterval,
getty.HostAddress(conf.ServerHost, conf.ServerPort), gxnet.HostAddress(conf.ServerHost, conf.ServerPort),
) )
client.gettyClient.RunEventLoop(newSession) client.gettyClient.RunEventLoop(newSession)
} }
...@@ -166,7 +168,7 @@ func test() { ...@@ -166,7 +168,7 @@ func test() {
var ( var (
cost int64 cost int64
counter getty.CountWatch counter gxtime.CountWatch
) )
counter.Start() counter.Start()
for i := 0; i < conf.EchoTimes; i++ { for i := 0; i < conf.EchoTimes; i++ {
......
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
import ( import (
"github.com/AlexStocks/getty" "github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor" "github.com/AlexStocks/gocolor"
"github.com/AlexStocks/goext/net"
log "github.com/AlexStocks/log4go" log "github.com/AlexStocks/log4go"
) )
...@@ -66,7 +67,7 @@ func initProfiling() { ...@@ -66,7 +67,7 @@ func initProfiling() {
) )
// addr = *host + ":" + "10000" // addr = *host + ":" + "10000"
addr = getty.HostAddress(conf.Host, conf.ProfilePort) addr = gxnet.HostAddress(conf.Host, conf.ProfilePort)
log.Info("App Profiling startup on address{%v}", addr+pprofPath) log.Info("App Profiling startup on address{%v}", addr+pprofPath)
go func() { go func() {
log.Info(http.ListenAndServe(addr, nil)) log.Info(http.ListenAndServe(addr, nil))
...@@ -127,7 +128,7 @@ func initServer() { ...@@ -127,7 +128,7 @@ func initServer() {
server = getty.NewServer() server = getty.NewServer()
// addr = *host + ":" + port // addr = *host + ":" + port
// addr = conf.Host + ":" + port // addr = conf.Host + ":" + port
addr = getty.HostAddress2(conf.Host, port) addr = gxnet.HostAddress2(conf.Host, port)
err = server.Listen("tcp", addr) err = server.Listen("tcp", addr)
if err != nil { if err != nil {
panic(fmt.Sprintf("server.Listen(tcp, addr:%s) = error{%#v}", addr, err)) panic(fmt.Sprintf("server.Listen(tcp, addr:%s) = error{%#v}", addr, err))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment