MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / Stop

Method Stop

blockproducer/chain.go:342–363  ·  view source on GitHub ↗

Stop stops the main process of the sql-chain.

()

Source from the content-addressed store, hash-verified

340
341// Stop stops the main process of the sql-chain.
342func (c *Chain) Stop() (err error) {
343 // Stop main process
344 var le = log.WithFields(log.Fields{
345 "local": c.getLocalBPInfo(),
346 })
347 le.Debug("stopping chain")
348 c.stop()
349 le.Debug("chain service stopped")
350 c.storage.Close()
351 le.Debug("chain database closed")
352
353 // FIXME(leventeliu): RPC server should provide an `unregister` method to detach chain service
354 // instance. Add it to Chain.stop(), then working channels can be closed safely.
355 // Otherwise a DATARACE (while closing a channel with a blocking write from RPC service) or
356 // `write on closed channel` panic may occur.
357 // Comment this out for now, IT IS A RESOURCE LEAK.
358 //
359 //close(c.pendingBlocks)
360 //close(c.pendingTxs)
361
362 return
363}
364
365func (c *Chain) pushBlock(b *types.BPBlock) (err error) {
366 var ierr error

Callers 3

TestChainFunction · 0.45
mainCycleMethod · 0.45

Calls 5

getLocalBPInfoMethod · 0.95
stopMethod · 0.95
WithFieldsFunction · 0.92
DebugMethod · 0.80
CloseMethod · 0.65

Tested by 1

TestChainFunction · 0.36