提交 00a193c5 作者: Dr Ian Preston 提交者: Steven Allen

Use request context in p2p stream http proxy

License: MIT
Signed-off-by: 's avatarIan Preston <ianopolous@protonmail.com>
上级 58a3ea14
...@@ -3,8 +3,8 @@ package corehttp ...@@ -3,8 +3,8 @@ package corehttp
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"net"
"io" "io"
"net"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"strings" "strings"
...@@ -28,7 +28,7 @@ func ProxyOption() ServeOption { ...@@ -28,7 +28,7 @@ func ProxyOption() ServeOption {
} }
// open connect to peer // open connect to peer
stream, err := ipfsNode.P2P.PeerHost.NewStream(ipfsNode.Context(), parsedRequest.target, protocol.ID("/x/"+parsedRequest.name)) stream, err := ipfsNode.P2P.PeerHost.NewStream(request.Context(), parsedRequest.target, protocol.ID("/x/"+parsedRequest.name))
if err != nil { if err != nil {
msg := fmt.Sprintf("Failed to open stream '%v' to target peer '%v'", parsedRequest.name, parsedRequest.target) msg := fmt.Sprintf("Failed to open stream '%v' to target peer '%v'", parsedRequest.name, parsedRequest.target)
handleError(w, msg, err, 500) handleError(w, msg, err, 500)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论