1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-11 18:20:28 +09:00

Some streampool changes and incoming guard

This commit is contained in:
mcrakhman 2024-06-09 00:53:38 +02:00
parent a05700e0f6
commit bcfe02122c
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
10 changed files with 74 additions and 131 deletions

View file

@ -2,7 +2,6 @@ package synctest
import (
"context"
"fmt"
"storj.io/drpc"
@ -16,14 +15,11 @@ type CounterRequestSender struct {
func (c *CounterRequestSender) SendStreamRequest(ctx context.Context, rq syncdeps.Request, receive func(stream drpc.Stream) error) (err error) {
peerId := rq.PeerId()
fmt.Println("getting peer", peerId, rq.PeerId(), rq.ObjectId())
pr, err := c.peerProvider.GetPeer(peerId)
if err != nil {
return err
}
fmt.Println("sending stream request with peer", pr.Id(), rq.PeerId(), rq.ObjectId())
return pr.DoDrpc(ctx, func(conn drpc.Conn) error {
fmt.Println("after connection", pr.Id(), rq.PeerId(), rq.ObjectId())
cl := synctestproto.NewDRPCCounterSyncClient(conn)
stream, err := cl.CounterStreamRequest(ctx, rq.Proto().(*synctestproto.CounterRequest))
if err != nil {