lower response time
This commit is contained in:
@@ -66,7 +66,7 @@ func startTunnelRequest(opt ConfigOptions, installService bool) (bool, error) {
|
||||
}
|
||||
defer conn.Close()
|
||||
c := pb.NewTunnelServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
|
||||
defer cancel()
|
||||
_, err = c.Start(ctx, &pb.TunnelStartRequest{
|
||||
Ipv6: opt.IPv6Mode == option.DomainStrategy(dns.DomainStrategyUseIPv4),
|
||||
@@ -94,7 +94,7 @@ func stopTunnelRequest() (bool, error) {
|
||||
}
|
||||
defer conn.Close()
|
||||
c := pb.NewTunnelServiceClient(conn)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*1)
|
||||
defer cancel()
|
||||
|
||||
_, err = c.Stop(ctx, &pb.Empty{})
|
||||
|
||||
@@ -3,6 +3,7 @@ package v2
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
pb "github.com/hiddify/libcore/hiddifyrpc"
|
||||
@@ -67,12 +68,14 @@ func makeTunnelConfig(Ipv6 bool, ServerPort int32, StrictRoute bool, EndpointInd
|
||||
}
|
||||
|
||||
func (s *TunnelService) Stop(ctx context.Context, _ *pb.Empty) (*pb.TunnelResponse, error) {
|
||||
_, err := Stop()
|
||||
res, err := Stop()
|
||||
log.Printf("Stop Result: %+v\n", res)
|
||||
if err != nil {
|
||||
return &pb.TunnelResponse{
|
||||
Message: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &pb.TunnelResponse{
|
||||
Message: "OK",
|
||||
}, err
|
||||
|
||||
Reference in New Issue
Block a user