mirror of
https://github.com/logos-messaging/go-libp2p-rendezvous.git
synced 2026-01-02 12:53:13 +00:00
refactor service constructor into two parts
This commit is contained in:
parent
fbaf21c098
commit
4e3eaa7ba0
7
svc.go
7
svc.go
@ -36,9 +36,14 @@ func NewRendezvousService(ctx context.Context, host host.Host, dbpath string, rz
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rz := NewRendezvousServiceWithDB(host, db, rzs...)
|
||||
return rz, nil
|
||||
}
|
||||
|
||||
func NewRendezvousServiceWithDB(host host.Host, db *DB, rzs ...RendezvousSync) *RendezvousService {
|
||||
rz := &RendezvousService{DB: db, rzs: rzs}
|
||||
host.SetStreamHandler(RendezvousProto, rz.handleStream)
|
||||
return rz, nil
|
||||
return rz
|
||||
}
|
||||
|
||||
func (rz *RendezvousService) handleStream(s inet.Stream) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user