Fix Close bugs
Created by: VoidingWarranties
There were a few bugs pertaining to module closing that are fixed in this PR:
- module Close methods would return immediately on error instead of finishing cleanup
- not all modules were Closed on API shutdown
- the gateway did not disconnect from its peers on shutdown
and a few improvements:
- module Close errors are returned from
Server.Close
instead ofServer.Serve
-
Server.Close
waits forServer.Serve
to terminate before terminating itself. This ensures the server is completely shutdown whenServer.Close
is done.
Also, the gateway now uses persist.Logger
instead of log.Logger
to be consistent with other modules.
Closes #1015 (closed)