Commit e1bbe623 authored by AlexStocks's avatar AlexStocks

delete shutdown

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