// shutdown all connections, terminate all background processing
shutdown all connections, terminate all background processing
// shutdown all connections terminate all background processing
func (twoway *Bilateral) Close() {
	log.Info("closing…")
	for to := range twoway.connections {
		twoway.DisconnectFrom(to)
	}
	close(twoway.shutdownAll)
	twoway.listenSocket.Close()
	twoway.outgoingSocket.Close()
	log.Info("Close: waiting…")
	<-twoway.rpcShutdown
	<-twoway.reactorShutdown
	close(twoway.rpcClientRequestChannel)
	close(twoway.rpcClientResponseChannel)
	close(twoway.rpcServerCallChannel)
	close(twoway.rpcServerBackChannel)
	for _, request := range twoway.rpcReturns {
		twoway.finishRequest(request)
	}
	for e := twoway.timeoutQueue.Front(); nil != e; e = e.Prev() {
		twoway.timeoutQueue.Remove(e)
	}
	log.Info("Close: complete")
}
func ( twoway * Bilateral ) Close ( ) { log . Info ( " for to := range twoway . connections { twoway . DisconnectFrom ( to ) } close ( twoway . shutdownAll ) twoway . listenSocket . Close ( ) twoway . outgoingSocket . Close ( ) log . Info ( " <- twoway . rpcShutdown <- twoway . reactorShutdown close ( twoway . rpcClientRequestChannel ) close ( twoway . rpcClientResponseChannel ) close ( twoway . rpcServerCallChannel ) close ( twoway . rpcServerBackChannel ) for _ , request := range twoway . rpcReturns { twoway . finishRequest ( request ) } for e := twoway . timeoutQueue . Front ( ) ; nil != e ; e = e . Prev ( ) { twoway . timeoutQueue . Remove ( e ) } log . Info ( " " ) }
shutdown all connections, terminate all background processing
shutdown all connections terminate all background processing
// disconnect all outgoing connections // shutdown background processing // close sockets so reactor will stop // wait for final shutdown // close any remaining channels // terminate all outstanding calls // clear the timeout queue