packages/hyprspace: 0.6.0 -> 0.6.1, close PeX streams correctly

This commit is contained in:
Max Headroom 2023-03-23 23:26:38 +01:00
parent 3792b2be5c
commit 9358527fb5
2 changed files with 5 additions and 1 deletions

View file

@ -82,8 +82,10 @@ func RequestPeX(ctx context.Context, host host.Host, peers []peer.ID) (addrInfos
for { for {
str, err := buf.ReadString('\n') str, err := buf.ReadString('\n')
if err == io.EOF { if err == io.EOF {
s.Close()
return addrInfos, nil return addrInfos, nil
} else if checkErrPeX(err, s) { } else if checkErrPeX(err, s) {
s.Close()
return nil, err return nil, err
} }
str = strings.TrimSuffix(str, "\n") str = strings.TrimSuffix(str, "\n")
@ -92,10 +94,12 @@ func RequestPeX(ctx context.Context, host host.Host, peers []peer.ID) (addrInfos
addrStr := splits[1] addrStr := splits[1]
peerId, err := peer.Decode(idStr) peerId, err := peer.Decode(idStr)
if checkErrPeX(err, s) { if checkErrPeX(err, s) {
s.Close()
return nil, err return nil, err
} }
ma, err := multiaddr.NewMultiaddr(addrStr) ma, err := multiaddr.NewMultiaddr(addrStr)
if checkErrPeX(err, s) { if checkErrPeX(err, s) {
s.Close()
return nil, err return nil, err
} }
fmt.Printf("[-] Got PeX peer: %s/p2p/%s\n", addrStr, idStr) fmt.Printf("[-] Got PeX peer: %s/p2p/%s\n", addrStr, idStr)

View file

@ -10,7 +10,7 @@
}; };
packages.hyprspace = with pkgs; buildGo119Module { packages.hyprspace = with pkgs; buildGo119Module {
pname = "hyprspace"; pname = "hyprspace";
version = "0.6.0"; version = "0.6.1";
src = with inputs.nix-filter.lib; let src = with inputs.nix-filter.lib; let
dirs = map inDirectory; dirs = map inDirectory;