aboutsummaryrefslogtreecommitdiffstats
path: root/server.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-01-22 06:27:08 +0800
committerobscuren <geffobscura@gmail.com>2014-01-22 06:27:08 +0800
commit3616080db46931202003157bacf10748008bebc0 (patch)
treea2004c7c4c8f6c91999b734b75a57ac31b04cb97 /server.go
parente47230f82da93ef0110faa76211b9b6f13b1060b (diff)
downloaddexon-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.go34
1 files changed, 19 insertions, 15 deletions
diff --git a/server.go b/server.go
index 3a35a43a2..2927f023a 100644
--- a/server.go
+++ b/server.go
@@ -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