Skip to content

Commit

Permalink
wip(daemon): remove traces
Browse files Browse the repository at this point in the history
  • Loading branch information
juligasa committed Aug 6, 2024
1 parent fdb0aa3 commit 199ec58
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion backend/daemon/daemon_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestSyncingProfiles(t *testing.T) {
// to force any syncing just wait for bob to instantly syncs content right after connection.
//_, err = bob.RPC.Daemon.ForceSync(ctx, &daemon.ForceSyncRequest{})
//require.NoError(t, err)
time.Sleep(time.Millisecond * 200)
time.Sleep(time.Millisecond * 300)
doc2, err := bob.RPC.DocumentsV3.GetDocument(ctx, &documents.GetDocumentRequest{
Account: aliceIdentity.Account.Principal().String(),
Path: "",
Expand Down
9 changes: 0 additions & 9 deletions backend/mttnet/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ func (n *Node) connect(ctx context.Context, info peer.AddrInfo, force bool) (err
}

isConnected := n.p2p.Host.Network().Connectedness(info.ID) == network.Connected
fmt.Println("DBG 1")
conn, release, err := n.db.Conn(ctx)
if err != nil {
return err
}
fmt.Println("DBG 2")
didHandshake := false
if err = sqlitex.Exec(conn, qGetPeer(), func(stmt *sqlite.Stmt) error {
pidStr := stmt.ColumnText(0)
Expand All @@ -87,7 +85,6 @@ func (n *Node) connect(ctx context.Context, info peer.AddrInfo, force bool) (err
return err
}
release()
fmt.Println("DBG 3")
if isConnected && didHandshake {
return nil
}
Expand All @@ -109,27 +106,22 @@ func (n *Node) connect(ctx context.Context, info peer.AddrInfo, force bool) (err
sw.Backoff().Clear(info.ID)
}
}
fmt.Println("DBG 4")
if err := n.p2p.Host.Connect(ctx, info); err != nil {
return fmt.Errorf("failed to connect to peer %s: %w", info.ID, err)
}
fmt.Println("DBG 5")
if err := n.CheckHyperMediaProtocolVersion(ctx, info.ID, n.protocol.version); err != nil {
return err
}

addrsStr := AddrInfoToStrings(info)
fmt.Println("DBG 6")
c, err := n.client.Dial(ctx, info.ID)
if err != nil {
return fmt.Errorf("Could not get p2p client: %w", err)
}
fmt.Println("DBG 7")
res, err := c.ListPeers(ctx, &p2p.ListPeersRequest{PageSize: math.MaxInt32})
if err != nil {
return fmt.Errorf("Could not get list of peers: %w", err)
}
fmt.Println("DBG 8")
conn, release, err = n.db.Conn(ctx)
if err != nil {
return err
Expand All @@ -148,7 +140,6 @@ func (n *Node) connect(ctx context.Context, info peer.AddrInfo, force bool) (err

return sqlitex.Exec(conn, sqlStr, nil, vals...)
}
fmt.Println("DBG 9")
return sqlitex.Exec(conn, "INSERT OR REPLACE INTO peers (pid, addresses) VALUES (?, ?);", nil, info.ID.String(), strings.Join(addrsStr, ","))
}

Expand Down
4 changes: 0 additions & 4 deletions backend/mttnet/list_peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mttnet

import (
"context"
"fmt"
"math"
p2p "seed/backend/genproto/p2p/v1alpha"
"seed/backend/util/apiutil"
Expand All @@ -29,12 +28,10 @@ var qListPeers = dqb.Str(`
func (srv *rpcMux) ListPeers(ctx context.Context, in *p2p.ListPeersRequest) (*p2p.ListPeersResponse, error) {
net := srv.Node
out := &p2p.ListPeersResponse{}
fmt.Println("ListPeers Called!!!")
conn, release, err := srv.Node.db.Conn(ctx)
if err != nil {
return nil, err
}
fmt.Println("ListPeers after connection")
defer release()
type Cursor struct {
ID int64 `json:"i"`
Expand Down Expand Up @@ -77,7 +74,6 @@ func (srv *rpcMux) ListPeers(ctx context.Context, in *p2p.ListPeersRequest) (*p2
}, lastCursor.ID, in.PageSize); err != nil {
return nil, err
}
fmt.Println("ListPeers after query")
out.Peers = make([]*p2p.PeerInfo, 0, len(peersInfo))

for _, peer := range peersInfo {
Expand Down

0 comments on commit 199ec58

Please sign in to comment.