mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 10:33:11 -06:00
Another try?
This commit is contained in:
parent
66092fc08b
commit
ae32587641
|
|
@ -80,7 +80,7 @@ type P2PMonolith struct {
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
httpListenAddr string
|
httpListenAddr string
|
||||||
stopHandlingEvents chan bool
|
stopHandlingEvents chan bool
|
||||||
startUpLock sync.Mutex
|
httpServerMu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateDefaultConfig(sk ed25519.PrivateKey, storageDir string, cacheDir string, dbPrefix string) *config.Dendrite {
|
func GenerateDefaultConfig(sk ed25519.PrivateKey, storageDir string, cacheDir string, dbPrefix string) *config.Dendrite {
|
||||||
|
|
@ -219,8 +219,10 @@ func (p *P2PMonolith) WaitForShutdown() {
|
||||||
|
|
||||||
func (p *P2PMonolith) closeAllResources() {
|
func (p *P2PMonolith) closeAllResources() {
|
||||||
logrus.Info("Closing monolith resources")
|
logrus.Info("Closing monolith resources")
|
||||||
|
p.httpServerMu.Lock()
|
||||||
if p.httpServer != nil {
|
if p.httpServer != nil {
|
||||||
_ = p.httpServer.Shutdown(context.Background())
|
_ = p.httpServer.Shutdown(context.Background())
|
||||||
|
p.httpServerMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
@ -298,9 +300,8 @@ func (p *P2PMonolith) setupHttpServers(userProvider *users.PineconeUserProvider,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *P2PMonolith) startHTTPServers() {
|
func (p *P2PMonolith) startHTTPServers() {
|
||||||
p.startUpLock.Lock()
|
|
||||||
defer p.startUpLock.Unlock()
|
|
||||||
go func() {
|
go func() {
|
||||||
|
p.httpServerMu.Lock()
|
||||||
// Build both ends of a HTTP multiplex.
|
// Build both ends of a HTTP multiplex.
|
||||||
p.httpServer = &http.Server{
|
p.httpServer = &http.Server{
|
||||||
Addr: ":0",
|
Addr: ":0",
|
||||||
|
|
@ -313,7 +314,7 @@ func (p *P2PMonolith) startHTTPServers() {
|
||||||
},
|
},
|
||||||
Handler: p.pineconeMux,
|
Handler: p.pineconeMux,
|
||||||
}
|
}
|
||||||
|
p.httpServerMu.Unlock()
|
||||||
pubkey := p.Router.PublicKey()
|
pubkey := p.Router.PublicKey()
|
||||||
pubkeyString := hex.EncodeToString(pubkey[:])
|
pubkeyString := hex.EncodeToString(pubkey[:])
|
||||||
logrus.Info("Listening on ", pubkeyString)
|
logrus.Info("Listening on ", pubkeyString)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue