Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Commit 2dd65d8

Browse files
committed
Fix Infinite Loop & Misspelling
1 parent 3a0d377 commit 2dd65d8

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

cli/up.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type UpArgs struct {
4545
}
4646

4747
type UpFlags struct {
48-
Forground bool `short:"f" long:"forground" desc:"Don't Create Background Daemon."`
48+
Foreground bool `short:"f" long:"foreground" desc:"Don't Create Background Daemon."`
4949
}
5050

5151
func UpRun(r *cmd.Root, c *cmd.Sub) {
@@ -65,7 +65,7 @@ func UpRun(r *cmd.Root, c *cmd.Sub) {
6565
Global, err := config.Read(configPath)
6666
checkErr(err)
6767

68-
if !flags.Forground {
68+
if !flags.Foreground {
6969
// Make results chan
7070
out := make(chan bool)
7171
go createDaemon(out)
@@ -163,7 +163,7 @@ func createDaemon(out chan<- bool) {
163163
// Create Sub Process
164164
process, err := os.StartProcess(
165165
path,
166-
append(os.Args, "--forground"),
166+
append(os.Args, "--foreground"),
167167
&os.ProcAttr{
168168
Files: []*os.File{nil, w, nil},
169169
},
@@ -184,7 +184,7 @@ func createDaemon(out chan<- bool) {
184184
func streamHandler(stream network.Stream) {
185185
// If the remote node ID isn't in the list of known nodes don't respond.
186186
if _, ok := RevLookup[stream.Conn().RemotePeer().Pretty()]; !ok {
187-
stream.Close()
187+
stream.Reset()
188188
}
189189
io.Copy(iface.ReadWriteCloser, stream)
190190
stream.Close()
@@ -195,7 +195,7 @@ func prettyDiscovery(ctx context.Context, node host.Host, peerTable map[string]p
195195
for ip, id := range peerTable {
196196
tempTable[ip] = id
197197
}
198-
for len(peerTable) > 0 {
198+
for len(tempTable) > 0 {
199199
for ip, id := range tempTable {
200200
stream, err := node.NewStream(ctx, id, p2p.Protocol)
201201
if err != nil && (strings.HasPrefix(err.Error(), "failed to dial") ||

p2p/node.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import (
1616

1717
const Protocol = "/hyprspace/0.0.1"
1818

19+
type Packet struct {
20+
Plen int
21+
Data []byte
22+
}
23+
1924
func CreateNode(ctx context.Context, inputKey string, handler network.StreamHandler) (node host.Host, dhtOut *dht.IpfsDHT, err error) {
2025
// Unmarshall Private Key
2126
privateKey, err := crypto.UnmarshalPrivateKey([]byte(inputKey))

0 commit comments

Comments
 (0)