WIP: Json rpc federation, search/getclaimbyid, and shutdown #76

Merged
jeffreypicard merged 11 commits from json-rpc-federation-and-shutdown into master 2022-12-07 17:01:36 +01:00
3 changed files with 22 additions and 15 deletions
Showing only changes of commit 99a9d37f8c - Show all commits

View file

@ -43,7 +43,7 @@ func main() {
return return
} }
conn, err := grpc.Dial("localhost:"+string(args.Port), conn, err := grpc.Dial("localhost:"+fmt.Sprintf("%d", args.Port),
grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithBlock(), grpc.WithBlock(),
) )

View file

@ -1,14 +1,16 @@
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
package server package server
import ( import (
"context" "errors"
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
pb "github.com/lbryio/herald.go/protobuf/go"
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
type PeersService struct { type PeersService struct {
Server *Server Server *Server
// needed for subscribe/unsubscribe
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
sessionMgr *sessionManager
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
session *session
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
} }
type PeersSubscribeReq struct { type PeersSubscribeReq struct {
@ -22,23 +24,16 @@ type PeersSubscribeResp string
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
// Features is the json rpc endpoint for 'server.peers.subcribe'. // Features is the json rpc endpoint for 'server.peers.subcribe'.
func (t *PeersService) Subscribe(req *PeersSubscribeReq, res **PeersSubscribeResp) error { func (t *PeersService) Subscribe(req *PeersSubscribeReq, res **PeersSubscribeResp) error {
log.Println("PeersSubscribe") log.Println("PeersSubscribe")
ctx := context.Background() // var port = "50001"
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
var port = "50001"
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
// FIXME: Get the actual port from the request details // FIXME: Get the actual port from the request details
msg := &pb.ServerMessage{ if t.sessionMgr == nil || t.session == nil {
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
Address: req.Ip,
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
Port: port,
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
}
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
peers, err := t.Server.PeerSubscribe(ctx, msg)
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
if err != nil {
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
log.Println(err)
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
*res = nil *res = nil
return err return errors.New("no session, rpc not supported")
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
} }
t.sessionMgr.peersSubscribe(t.session, true /*subscribe*/)
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
*res = (*PeersSubscribeResp)(&peers.Value) *res = nil
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
return nil return nil
} }

moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah
moodyjon commented 2022-11-17 19:39:11 +01:00 (Migrated from github.com)
Review

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have sessionManager.peersSubs already in place.

Might as well complete this by adding sessionManager to PeersService (or other appropriate pointer). You have `sessionManager.peersSubs` already in place.
moodyjon commented 2022-11-19 01:10:46 +01:00 (Migrated from github.com)
Review

Ahh.... I meant register the subscription in the sessionManager.peerSubs map. It needs registration there as it's communicating by JSONRPC. Then inside Server.notifyPeerSubs, call s.sessionManager.doNotify() to forward a notification to the session-based mechanism.

The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping Server.PeerSubs for those.

Ahh.... I meant register the subscription in the `sessionManager.peerSubs` map. It needs registration there as it's communicating by JSONRPC. Then inside `Server.notifyPeerSubs`, call `s.sessionManager.doNotify()` to forward a notification to the session-based mechanism. The stuff in federation.go is more oriented towards grpc service (and managing the list of known peers). If PeersSubscribe comes in via GRPC, there's a separate mapping `Server.PeerSubs` for those.
jeffreypicard commented 2022-11-19 08:34:17 +01:00 (Migrated from github.com)
Review

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

Ahh, yeah, just hooking it into the gRPC like this isn't going to quite work I suppose hahah

View file

@ -313,6 +313,18 @@ func (sm *sessionManager) broadcastTx(rawTx []byte) (*chainhash.Hash, error) {
return nil, nil return nil, nil
} }
func (sm *sessionManager) peersSubscribe(sess *session, subscribe bool) {
sm.sessionsMut.Lock()
defer sm.sessionsMut.Unlock()
if subscribe {
sm.peerSubs[sess.id] = sess
sess.peersSub = true
return
}
delete(sm.peerSubs, sess.id)
sess.peersSub = false
}
func (sm *sessionManager) headersSubscribe(sess *session, raw bool, subscribe bool) { func (sm *sessionManager) headersSubscribe(sess *session, raw bool, subscribe bool) {
sm.sessionsMut.Lock() sm.sessionsMut.Lock()
defer sm.sessionsMut.Unlock() defer sm.sessionsMut.Unlock()