refactor: add getter/setter for isConnected

This commit is contained in:
Derrick Hammer 2024-01-08 08:42:53 -05:00
parent 3c1a9cc526
commit a785031255
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,8 @@ type Peer interface {
Challenge() []byte
SetSocket(socket interface{})
Socket() interface{}
SetConnected(isConnected bool)
IsConnected() bool
}
type BasePeer struct {
@ -49,6 +51,14 @@ type BasePeer struct {
id *encoding.NodeId
}
func (b *BasePeer) IsConnected() bool {
return b.isConnected
}
func (b *BasePeer) SetConnected(isConnected bool) {
b.isConnected = isConnected
}
func (b *BasePeer) SendMessage(message []byte) error {
panic("must implement in child class")
}