删除某个cancel
This commit is contained in:
parent
eead5b9d5f
commit
0c64d3e838
8
tap.go
8
tap.go
|
@ -12,7 +12,6 @@ import (
|
||||||
"github.com/songgao/packets/ethernet"
|
"github.com/songgao/packets/ethernet"
|
||||||
"github.com/songgao/water"
|
"github.com/songgao/water"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/connectivity"
|
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,10 +39,6 @@ func (cli *RPCClient) connect() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
log.Println(conn.WaitForStateChange(ctx, connectivity.Idle))
|
|
||||||
cli.conn = conn
|
cli.conn = conn
|
||||||
go cli.run()
|
go cli.run()
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
|
@ -59,6 +54,7 @@ func (cli *RPCClient) run() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
c := gen.NewFrameServiceClient(cli.conn)
|
c := gen.NewFrameServiceClient(cli.conn)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
stream, err := c.SendFrames(ctx)
|
stream, err := c.SendFrames(ctx)
|
||||||
|
@ -144,7 +140,7 @@ func (nc *NetCard) runRead() {
|
||||||
framesBytes = append(framesBytes, []byte(rframe))
|
framesBytes = append(framesBytes, []byte(rframe))
|
||||||
}
|
}
|
||||||
|
|
||||||
println(len(framesBytes))
|
log.Println(len(framesBytes))
|
||||||
if len(framesBytes) > 0 {
|
if len(framesBytes) > 0 {
|
||||||
if nc.cli.conn == nil {
|
if nc.cli.conn == nil {
|
||||||
nc.cli.connect()
|
nc.cli.connect()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user