decred / dcrlnd

Decred Lightning Network Daemon ⚡️
MIT License
36 stars 24 forks source link

lnd: Sleep before stopping wallet unlocker server #122

Closed matheusd closed 3 years ago

matheusd commented 4 years ago

This adds a time.Sleep() call before stopping the gRPC server used for the wallet unlocker service and consequently before closing the listeners for the given server.

Some gRPC client libraries, such as grpc-js used in nodejs/Electron apps (i.e. Decrediton) have trouble processing the response to a call if the socket is closed immediately after the response is returned.

The gRPC library currently used in dcrlnd does not offer any method of identifying whether there are outstanding calls or clients, therefore we resort to a simple sleep that, while not fundamentally fixing the underlying issue, alleviates it for the most common use case.