Commit 6133edd0 authored by AlexStocks's avatar AlexStocks

change interface by getty 0.8.1

parent a4ce4402
......@@ -103,7 +103,7 @@ func newSession(session getty.Session) error {
}
func initClient() {
client.gettyClient = getty.NewClient(
client.gettyClient = getty.NewTCPClient(
(int)(conf.ConnectionNum),
conf.connectInterval,
gxnet.HostAddress(conf.ServerHost, conf.ServerPort),
......
......@@ -10,5 +10,5 @@
package main
var (
Version = "0.4.04"
Version = "0.8.01"
)
......@@ -109,7 +109,6 @@ func newSession(session getty.Session) error {
func initServer() {
var (
err error
addr string
portList []string
server *getty.Server
......@@ -129,15 +128,8 @@ func initServer() {
panic("portList is nil")
}
for _, port := range portList {
server = getty.NewServer()
// addr = *host + ":" + port
// addr = conf.Host + ":" + port
addr = gxnet.HostAddress2(conf.Host, port)
err = server.Listen("tcp", addr)
if err != nil {
panic(fmt.Sprintf("server.Listen(tcp, addr:%s) = error{%#v}", addr, err))
}
server = getty.NewTCPServer(addr)
// run server
server.RunEventloop(newSession)
log.Debug("server bind addr{%s} ok!", addr)
......
......@@ -10,5 +10,5 @@
package main
var (
Version = "0.4.04"
Version = "0.8.01"
)
......@@ -111,7 +111,7 @@ func newSession(session getty.Session) error {
}
func initClient() {
client.gettyClient = getty.NewClient(
client.gettyClient = getty.NewWSClient(
(int)(conf.ConnectionNum),
conf.connectInterval,
gxnet.WSHostAddress(conf.ServerHost, conf.ServerPort, conf.ServerPath),
......
......@@ -10,5 +10,5 @@
package main
var (
Version = "0.4.04"
Version = "0.8.01"
)
......@@ -117,7 +117,6 @@ func newSession(session getty.Session) error {
func initServer() {
var (
err error
addr string
portList []string
pathList []string
......@@ -145,16 +144,11 @@ func initServer() {
panic("the @Ports's length is not equal to @Paths.")
}
for idx, port := range portList {
server = getty.NewServer()
// addr = *host + ":" + port
// addr = conf.Host + ":" + port
addr = gxnet.HostAddress2(conf.Host, port)
err = server.Listen("tcp", addr)
if err != nil {
panic(fmt.Sprintf("server.Listen(tcp, addr:%s) = error{%#v}", addr, err))
}
server.RunWSEventLoop(newSession, pathList[idx])
server = getty.NewWSServer(addr, pathList[idx])
server.RunEventloop(newSession)
log.Debug("server bind addr{ws://%s/%s} ok!", addr, pathList[idx])
serverList = append(serverList, server)
}
......
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