Commit 4b879147 authored by wei.xuan's avatar wei.xuan

feat:remove unused

parent b2e16fa9
......@@ -123,9 +123,6 @@ func (c *client) dialTCP() Session {
)
for {
if c.IsClosed() {
return nil
}
if c.sslEnabled {
if sslConfig, buildTlsConfErr := c.tlsConfigBuilder.BuildTlsConfig(); buildTlsConfErr == nil && sslConfig != nil {
d := &net.Dialer{Timeout: connectTimeout}
......@@ -410,11 +407,6 @@ func (c *client) reConnect() {
interval = reconnectInterval
}
for {
if c.IsClosed() {
log.Warnf("client{peer:%s} goroutine exit now.", c.addr)
break
}
num = c.sessionNum()
if max <= num {
break
......@@ -425,7 +417,7 @@ func (c *client) reConnect() {
times = maxTimes
}
rinterval := time.Duration(int64(times) * int64(interval))
log.Infof("reConnect %+v", rinterval)
log.Infof("==============client reConnect %+v===========", rinterval)
<-gxtime.After(rinterval)
}
}
......
......@@ -26,7 +26,6 @@ import (
"sync"
"time"
"github.com/golang/snappy"
"github.com/gorilla/websocket"
perrors "github.com/pkg/errors"
uatomic "go.uber.org/atomic"
......@@ -240,11 +239,11 @@ func (t *gettyTCPConn) SetCompressType(c CompressType) {
}
t.writer = &writeFlusher{flusher: w}
case CompressSnappy:
ioReader := io.Reader(t.conn)
t.reader = snappy.NewReader(ioReader)
ioWriter := io.Writer(t.conn)
t.writer = snappy.NewBufferedWriter(ioWriter)
//case CompressSnappy:
// ioReader := io.Reader(t.conn)
// t.reader = snappy.NewReader(ioReader)
// ioWriter := io.Writer(t.conn)
// t.writer = snappy.NewBufferedWriter(ioWriter)
default:
panic(fmt.Sprintf("illegal comparess type %d", c))
......@@ -337,11 +336,11 @@ func (t *gettyTCPConn) close(waitSec int) {
// }
if t.conn != nil {
if writer, ok := t.writer.(*snappy.Writer); ok {
if err := writer.Close(); err != nil {
log.Errorf("snappy.Writer.Close() = error:%+v", err)
}
}
//if writer, ok := t.writer.(*snappy.Writer); ok {
// if err := writer.Close(); err != nil {
// log.Errorf("snappy.Writer.Close() = error:%+v", err)
// }
//}
if conn, ok := t.conn.(*net.TCPConn); ok {
_ = conn.SetLinger(waitSec)
_ = conn.Close()
......
......@@ -4,7 +4,6 @@ go 1.17
require (
github.com/adamweixuan/gostnops v1.11.20-0.20211029124314-3f0589fceea6
github.com/golang/snappy v0.0.4
github.com/gorilla/websocket v1.4.2
github.com/pkg/errors v0.9.1
go.uber.org/atomic v1.9.0
......
......@@ -5,8 +5,6 @@ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
......
......@@ -100,6 +100,7 @@ func SetLoggerCallerDisable() error {
var err error
zapLoggerConfig.Development = false
zapLoggerConfig.DisableCaller = true
zapLoggerConfig.DisableStacktrace = true
zapLogger, err = zapLoggerConfig.Build()
if err != nil {
return err
......
......@@ -381,7 +381,7 @@ func (s *session) WritePkg(pkg interface{}, timeout time.Duration) (int, int, er
pkgBytes, err := s.writer.Write(s, pkg)
if err != nil {
log.Warnf("%s, [session.WritePkg] session.writer.Write(@pkg:%#v) = error:%+v", s.Stat(), pkg, err)
return len(pkgBytes), 0, perrors.WithStack(err)
return len(pkgBytes), 0, err
}
var udpCtxPtr *UDPContext
if udpCtx, ok := pkg.(UDPContext); ok {
......@@ -402,7 +402,7 @@ func (s *session) WritePkg(pkg interface{}, timeout time.Duration) (int, int, er
succssCount, err = s.Connection.send(pkg)
if err != nil {
log.Warnf("%s, [session.WritePkg] @s.Connection.Write(pkg:%#v) = err:%+v", s.Stat(), pkg, err)
return len(pkgBytes), succssCount, perrors.WithStack(err)
return len(pkgBytes), succssCount, err
}
return len(pkgBytes), succssCount, nil
}
......
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