Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
djylb committed Oct 26, 2024
1 parent e6a4e2d commit 954cf60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server/proxy/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *httpServer) Start() error {
logs.Error(err)
os.Exit(0)
}
logs.Error(NewHttpsServer(s.httpsListener, s.bridge, s.useCache, s.cacheLen).Start())
logs.Error(NewHttpsServer(s.httpsListener, s.bridge, s.useCache, s.cacheLen, s.task).Start())
}()
}
return nil
Expand Down
14 changes: 11 additions & 3 deletions server/proxy/https.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ type HttpsServer struct {
hostIdCertMap sync.Map
}

func NewHttpsServer(l net.Listener, bridge NetBridge, useCache bool, cacheLen int) *HttpsServer {
https := &HttpsServer{listener: l}
https.bridge = bridge
func NewHttpsServer(l net.Listener, bridge NetBridge, useCache bool, cacheLen int, task *file.Tunnel) *HttpsServer {
https := &HttpsServer{
listener: l,
httpServer: httpServer{
BaseServer: BaseServer{
task: task, // 初始化 task 确保其不为空
bridge: bridge,
Mutex: sync.Mutex{},
},
},
}
https.useCache = useCache
if useCache {
https.cache = cache.New(cacheLen)
Expand Down

0 comments on commit 954cf60

Please sign in to comment.