Commit Graph

67 Commits

Author SHA1 Message Date
Anton Kaliaev 69b5da766c
service#Start, service#Stop signatures were changed
See https://github.com/tendermint/tmlibs/issues/45
2017-11-29 10:38:58 -06:00
Zach Ramsay 7ad8a8ab55 Tests almost passing 2017-11-27 22:39:12 +00:00
Zach Ramsay 15651a931e linting errors: tackle p2p package 2017-11-27 22:39:11 +00:00
Emmanuel Odeke 7b0fa6c889
p2p: peer should respect errors from SetDeadline
Noticed while auditing the code that we aren't respecting
(*net.Conn) SetDeadline errors which return after
a connection has been killed and is simultaneously
being used.

For example given program, without SetDeadline error checks
```go
package main

import (
  "log"
  "net"
  "time"
)

func main() {
  conn, err := net.Dial("tcp", "tendermint.com:443")
  if err != nil {
    log.Fatal(err)
  }
  go func() {
    <-time.After(400 * time.Millisecond)
    conn.Close()
  }()
  for i := 0; i < 5; i++ {
    if err := conn.SetDeadline(time.Now().Add(time.Duration(10 * time.Second))); err != nil {
      log.Fatalf("set deadline #%d, err: %v", i, err)
    }
    log.Printf("Successfully set deadline #%d", i)
    <-time.After(150 * time.Millisecond)
  }
}
```

erraneously gives
```shell
2017/11/14 17:46:28 Successfully set deadline #0
2017/11/14 17:46:29 Successfully set deadline #1
2017/11/14 17:46:29 Successfully set deadline #2
2017/11/14 17:46:29 Successfully set deadline #3
2017/11/14 17:46:29 Successfully set deadline #4
```

However, if we properly fix it to respect that error with
```diff
--- wild.go 2017-11-14 17:44:38.000000000 -0700
+++ main.go 2017-11-14 17:45:40.000000000 -0700
@@ -16,7 +16,9 @@
    conn.Close()
  }()
  for i := 0; i < 5; i++ {
-   conn.SetDeadline(time.Now().Add(time.Duration(10 * time.Second)))
+   if err := conn.SetDeadline(time.Now().Add(time.Duration(10 *
time.Second))); err != nil {
+     log.Fatalf("set deadline #%d, err: %v", i, err)
+   }
    log.Printf("Successfully set deadline #%d", i)
    <-time.After(150 * time.Millisecond)
  }
```

properly catches any problems and gives
```shell
$ go run main.go
2017/11/14 17:43:44 Successfully set deadline #0
2017/11/14 17:43:45 Successfully set deadline #1
2017/11/14 17:43:45 Successfully set deadline #2
2017/11/14 17:43:45 set deadline #3, err: set tcp 10.182.253.51:57395:
use of closed network connection
exit status 1
```
2017-11-14 18:01:51 -07:00
Anton Kaliaev a1cdc2b68a
set logger for peer's MConnection 2017-11-09 14:57:40 -05:00
Ethan Buchman c931279960 p2p: some fixes re @odeke-em issues #813,#816,#817 2017-11-08 17:54:29 +00:00
Petabyte Storage ceedd4d968 remove unnecessary plus [ci skip] 2017-10-25 22:28:20 -04:00
Zach Ramsay d56b44f3a5 all: no more anonymous imports 2017-10-04 16:40:45 -04:00
Ethan Buchman aea8629272 peer interface 2017-09-15 18:40:59 -04:00
Ethan Buchman 5f6b996d22 breakup some long lines; add more comments to consensus reactor 2017-07-09 18:38:59 -04:00
Ethan Buchman e6cecb9595 p2p: fix test 2017-07-07 13:33:15 -04:00
Ethan Buchman 3c10f7a122 add p2p flush throttle to config 2017-07-07 13:08:52 -04:00
Anton Kaliaev f8fdbe3dbc
changes as per Bucky's review 2017-05-13 16:22:51 +02:00
Anton Kaliaev f803544195
new logging 2017-05-13 10:24:58 +02:00
Ethan Buchman 5d660e073a remove viper from p2p 2017-05-04 22:43:55 -04:00
Ethan Buchman 23a6a6f8fc move into p2p package 2017-04-21 18:07:52 -04:00
Jae Kwon c4ed55d801 Refactor to move common libraries out of project 2015-10-22 17:39:06 -07:00
Ethan Buchman cccb722ba8 mempool tests 2015-09-29 12:30:46 -04:00
Jae Kwon 1c17ea3b14 blockchain parameter && log tweaks 2015-09-11 21:09:27 -07:00
Jae Kwon 21d45023d3 various bug fixes 2015-09-11 21:09:01 -07:00
Jae Kwon 625f23af13 Blockpool better timeouts, download rate observation, quicker switching to consensus; Id -> ID (sorry, this doesn't belong here) 2015-09-11 21:09:00 -07:00
Jae Kwon e86073ec96 Use rpc/client/ws_client; OnStart() returns error 2015-08-11 11:01:17 -07:00
Jae Kwon 3be3647dc8 tendermint/binary -> tendermint/wire 2015-07-28 12:18:17 -07:00
Jae Kwon e7c1febb65 Simplify Service/Reactor pattern 2015-07-22 06:21:21 -07:00
Ethan Buchman 8e50bf15de panic wrapper functions 2015-07-21 10:46:05 -04:00
Jae Kwon 571a134318 BaseService and BaseReactor refactor and unification 2015-07-20 14:52:24 -07:00
Jae Kwon c30d38270c base_service draft and some samples 2015-07-19 17:42:01 -07:00
Ethan Buchman bb4ca1407f info->notice, debug->info 2015-07-19 22:44:40 +00:00
Jae Kwon e4c351f5fc UUID -> PubKeyEd25519 2015-07-15 14:31:03 -07:00
Jae Kwon d13a593afd Parallel syntax change; SecretConnection implements net.Conn 2015-07-15 12:13:10 -07:00
Jae Kwon 4981a5993d fixed handshake test; wrote broken read/write test 2015-07-14 22:35:32 -07:00
Jae Kwon 402b3a3e52 draft of secret_connection 2015-07-14 17:52:54 -07:00
Jae Kwon bdc2711f27 p2p comment prettify 2015-07-13 13:17:47 -07:00
Ethan Buchman d0610845dc peers use uuid to avoid duplicate connections 2015-07-12 02:16:33 +00:00
Ethan Buchman 4f94e0f200 only allow one connection per ip 2015-05-01 18:06:15 -07:00
Ethan Buchman 0e80059e79 versioning 2015-04-23 16:53:28 -07:00
Ethan Buchman 67ea49c5fb Merge branch 'develop' of https://github.com/tendermint/tendermint into develop
Conflicts:
	p2p/peer.go
	rpc/core/net.go
	rpc/core/types/responses.go
2015-04-21 02:00:58 -07:00
Jae Kwon dc1fddd1d8 Added NodeInfo (still need to add to AddrBook); Proper Handshake 2015-04-20 15:29:01 -07:00
Ethan Buchman 882a82bad4 more crawler work 2015-04-20 14:00:19 -07:00
Jae Kwon 13b6508ecd Package import path change 2015-04-01 17:30:16 -07:00
Ethan Buchman 60f166e823 tendermint2 2015-03-31 15:33:31 -07:00
Jae Kwon 788f9bfb93 started/stopped -> running; contiguous vs fast forward ConsensusState
updates.
2015-03-25 13:01:28 -07:00
Jae Kwon 135894ea88 Dot import -> named import
Changed modulename_ to short module names
Also removed Unreader, replaced with PrefixdReader in select locations
2015-01-14 20:34:53 -08:00
Jae Kwon 07b5b7a8f2 various log fixes 2014-12-29 18:39:19 -08:00
Jae Kwon 0bfb389b35 change logger to log15 2014-12-29 18:09:06 -08:00
Jae Kwon 5bace5cce8 Unreader to unread bytes 2014-12-29 15:14:54 -08:00
Jae Kwon fa7c83166f P2P docs 2014-12-23 19:31:24 -08:00
Jae Kwon 83d313cbe5 Refactor Tx, Validator, and Account structure 2014-12-16 05:45:40 -08:00
Jae Kwon c3fc1a39ea BitArray sub fix 2014-11-05 03:11:38 -08:00
Jae Kwon 8e452aa0d2 fixed algorithm 2014-10-03 01:09:26 -07:00