fibercrypto / fibercrypto/skycoin
Implement ConnectionManager
- Dominant language
- Go
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Implement ConnectionManager on top of gnet.ConnectionPool. ConnectionManager provides basic implementation of connection management, needed by different types of P2P applications (not limited to Skycoin wallet).
ConnectionManager must provide methods for:
1. Sending pings via open connections.
2. Closing stale connections, which have not sent messages for certain period of time.
```go
// ConnectionManager
type ConnectionManager struct {
SendPings() error
CloseStaleConnections() error
}
```
Internally ConnectionManager must:
1. Handle ping messages by replying with pongs.
2. Register `PingMessage` and `PongMessage` types of `gnet.Message`.
```go
// PingMessage Sent to keep a connection alive. A PongMessage is sent in reply.
type PingMessage struct {
c *gnet.MessageContext `enc:"-"`
}
// PongMessage Sent in reply to a PingMessage. No action is taken when this is received.
type PongMessage struct {
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.