Browse Source

.

pull/9/head
Jae Kwon 10 years ago
parent
commit
ed19b7e0ae
2 changed files with 8 additions and 25 deletions
  1. +6
    -7
      blocks/codec_test.go
  2. +2
    -18
      main.go

+ 6
- 7
blocks/codec_test.go View File

@ -108,9 +108,6 @@ func BenchmarkTestGob(b *testing.B) {
func BenchmarkTestMsgPack(b *testing.B) {
b.StopTimer()
var mh codec.MsgpackHandle
handle := &mh
h := &Header{
Name: "Header",
Height: 123,
@ -123,8 +120,8 @@ func BenchmarkTestMsgPack(b *testing.B) {
h2 := &Header{}
buf := bytes.NewBuffer(nil)
enc := codec.NewEncoder(buf, handle)
dec := codec.NewDecoder(buf, handle)
enc := msgpack.NewEncoder(buf)
dec := msgpack.NewDecoder(buf)
b.StartTimer()
for i := 0; i < b.N; i++ {
@ -150,10 +147,12 @@ func BenchmarkTestMsgPack2(b *testing.B) {
DataHash: []byte("datahash"),
}
h2 := &Header{}
var mh codec.MsgpackHandle
handle := &mh
buf := bytes.NewBuffer(nil)
enc := msgpack.NewEncoder(buf)
dec := msgpack.NewDecoder(buf)
enc := codec.NewEncoder(buf, handle)
dec := codec.NewDecoder(buf, handle)
b.StartTimer()
for i := 0; i < b.N; i++ {


+ 2
- 18
main.go View File

@ -1,10 +1,8 @@
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"
@ -64,7 +62,7 @@ func main() {
go p2p.PexHandler(sw, book)
// Sleep forever
go _trapSignal()
trapSignal()
select {}
}
@ -73,26 +71,12 @@ func initPeer(peer *p2p.Peer) {
}
func trapSignal() {
ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGINT)
sig := <-ch
fmt.Println("???", sig)
os.Exit(0)
}
func _trapSignal() {
// capture ctrl+c and stop CPU profiler
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
//signal.Notify(c, syscall.SIGINT)
go func() {
fmt.Println("inside")
for sig := range c {
fmt.Println("signal!>>", sig)
log.Infof("captured %v, stopping profiler and exiting..", sig)
log.Infof("captured %v, exiting..", sig)
os.Exit(1)
}
fmt.Println("inside done")
}()
fmt.Println("ok")
}

Loading…
Cancel
Save