Commit e1bbe623 authored by AlexStocks's avatar AlexStocks

delete shutdown

parent 97fc48e6
......@@ -183,7 +183,7 @@ func (c *Client) dialWSS() Session {
dialer.EnableCompression = true
config = &tls.Config{
// InsecureSkipVerify: true,
InsecureSkipVerify: true,
}
gxlog.CInfo("client cert:%s, key:%s, caCert:%s", c.cert, c.privateKey, c.caCert)
......
......@@ -10,7 +10,7 @@
package getty
import (
"context"
// "context"
"crypto/tls"
"crypto/x509"
"errors"
......@@ -54,8 +54,8 @@ func NewServer() *Server {
func (s *Server) stop() {
var (
err error
ctx context.Context
// err error
// ctx context.Context
)
select {
case <-s.done:
......@@ -65,12 +65,12 @@ func (s *Server) stop() {
close(s.done)
s.lock.Lock()
if s.server != nil {
ctx, _ = context.WithTimeout(context.Background(), serverFastFailTimeout)
if err = s.server.Shutdown(ctx); err != nil {
// 如果下面内容输出为:server shutdown ctx: context deadline exceeded,
// 则说明有未处理完的active connections。
log.Error("server shutdown ctx:%#v", err)
}
// ctx, _ = context.WithTimeout(context.Background(), serverFastFailTimeout)
// if err = s.server.Shutdown(ctx); err != nil {
// // 如果下面内容输出为:server shutdown ctx: context deadline exceeded,
// // 则说明有未处理完的active connections。
// log.Error("server shutdown ctx:%#v", err)
// }
}
s.lock.Unlock()
// 把listener.Close放在这里,既能防止多次关闭调用,
......@@ -266,11 +266,14 @@ func (s *Server) RunWSSEventLoop(
server *http.Server
)
config = &tls.Config{InsecureSkipVerify: true}
config = &tls.Config{
InsecureSkipVerify: true,
ClientAuth: tls.NoClientCert,
}
config.Certificates = make([]tls.Certificate, 1)
gxlog.CInfo("server cert:%s, key:%s, caCert:%s", cert, privateKey, caCert)
if config.Certificates[0], err = tls.LoadX509KeyPair(cert, privateKey); err != nil {
log.Error("tls.LoadX509KeyPair(cert{%s}, privateKey{%s}) = err{%#v}", cert, privateKey, err)
panic(fmt.Sprintf("tls.LoadX509KeyPair(cert{%s}, privateKey{%s}) = err{%#v}", cert, privateKey, err))
return
}
......
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