diff options
author | obscuren <geffobscura@gmail.com> | 2014-01-22 06:27:08 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-01-22 06:27:08 +0800 |
commit | 3616080db46931202003157bacf10748008bebc0 (patch) | |
tree | a2004c7c4c8f6c91999b734b75a57ac31b04cb97 /server.go | |
parent | e47230f82da93ef0110faa76211b9b6f13b1060b (diff) | |
download | dexon-3616080db46931202003157bacf10748008bebc0.tar dexon-3616080db46931202003157bacf10748008bebc0.tar.gz dexon-3616080db46931202003157bacf10748008bebc0.tar.bz2 dexon-3616080db46931202003157bacf10748008bebc0.tar.lz dexon-3616080db46931202003157bacf10748008bebc0.tar.xz dexon-3616080db46931202003157bacf10748008bebc0.tar.zst dexon-3616080db46931202003157bacf10748008bebc0.zip |
Added synchronisation of transactions across remote pools
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -48,7 +48,7 @@ func NewServer() (*Server, error) { return nil, err } - ethutil.SetConfig(db) + ethutil.Config.Db = db nonce, _ := ethutil.RandomUint64() server := &Server{ @@ -152,28 +152,30 @@ func (s *Server) Start() { s.Stop() } - - return } else { log.Fatal(err) } + } else { + // Starting accepting connections + go func() { + for { + conn, err := ln.Accept() + if err != nil { + log.Println(err) + + continue + } + + go s.AddPeer(conn) + } + }() } // Start the reaping processes go s.ReapDeadPeers() - go func() { - for { - conn, err := ln.Accept() - if err != nil { - log.Println(err) - - continue - } - - go s.AddPeer(conn) - } - }() + // Start the tx pool + s.txPool.Start() // TMP /* @@ -196,6 +198,8 @@ func (s *Server) Stop() { }) s.shutdownChan <- true + + s.txPool.Stop() } // This function will wait for a shutdown and resumes main thread execution |