forked from TrueCloudLab/neoneo-go
Fix bug where channel for peers events is called after it's closed (#34)
* Disconnect once go routines signal so * Send msg if cmd is other than cmdUnknown * Remove typo * Fix lock file * Updates README * Comment typo * Fix issue * Revert old changes * Handle error
This commit is contained in:
parent
b6b8542caf
commit
e09c870f7f
3 changed files with 33 additions and 7 deletions
5
Makefile
5
Makefile
|
@ -1,5 +1,7 @@
|
|||
BRANCH = "master"
|
||||
VERSION = $(shell cat ./VERSION)
|
||||
SEEDS ?= "127.0.0.1:20333"
|
||||
PORT ?= "3000"
|
||||
|
||||
build:
|
||||
@go build -o ./bin/neo-go ./cli/main.go
|
||||
|
@ -16,6 +18,9 @@ push-tag:
|
|||
git tag ${VERSION}
|
||||
git push origin ${BRANCH} --tags
|
||||
|
||||
run: build
|
||||
./bin/neo-go node -seed ${SEEDS} -tcp ${PORT}
|
||||
|
||||
test:
|
||||
@go test ./... -cover
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -75,18 +75,24 @@ If you dont, take a look at [docker-privnet-with-gas](https://hub.docker.com/r/m
|
|||
Start a NEO node:
|
||||
|
||||
```
|
||||
./bin/neo-go node -seed 127.0.0.1:20333
|
||||
make run
|
||||
```
|
||||
|
||||
You can add multiple seeds if you want:
|
||||
|
||||
```
|
||||
./bin/neo-go node -seed 127.0.0.1:20333,127.0.01:20334
|
||||
make run -e SEEDS="127.0.0.1:20333,127.0.01:20334"
|
||||
```
|
||||
|
||||
By default the server will currently run on port 3000, for testing purposes.
|
||||
You can change that by setting the tcp flag:
|
||||
|
||||
```
|
||||
make run -e PORT="1337"
|
||||
```
|
||||
|
||||
To run the binary directly:
|
||||
|
||||
```
|
||||
./bin/neo-go node -seed 127.0.0.1:20333 -tcp 1337
|
||||
```
|
||||
|
|
|
@ -141,10 +141,25 @@ func (m *Message) commandType() commandType {
|
|||
|
||||
// decode a Message from the given reader.
|
||||
func (m *Message) decode(r io.Reader) error {
|
||||
binary.Read(r, binary.LittleEndian, &m.Magic)
|
||||
binary.Read(r, binary.LittleEndian, &m.Command)
|
||||
binary.Read(r, binary.LittleEndian, &m.Length)
|
||||
binary.Read(r, binary.LittleEndian, &m.Checksum)
|
||||
err := binary.Read(r, binary.LittleEndian, &m.Magic)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = binary.Read(r, binary.LittleEndian, &m.Command)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = binary.Read(r, binary.LittleEndian, &m.Length)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = binary.Read(r, binary.LittleEndian, &m.Checksum)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// return if their is no payload.
|
||||
if m.Length == 0 {
|
||||
|
|
Loading…
Reference in a new issue