fibercrypto / fibercrypto/fibercryptowallet

Improve networking interfaces

Open
#156 1 comment 0 reactions 2 assignees Claimed by @mauricio1802 View on GitHub
enhancement pex stdev wip
Dominant language
Go
Stars
29
Forks
15
PR merge metrics
No merged PRs in 30d

Description

**Feature description**

Further review of core networking interfaces unveiled possibilities for improvement

**Possible implementation**

- [ ] `PexNode.GetIp` should be renamed to a more generic method suitable for a broader number of network addresses. The function should return either a generic struct representing network addresses or an interface. The perfect choice would be to reuse a (standard) lower level type for this purpose.

- [ ] `PexNode.GetPort` is specific to IP stack , hence maybe both `GeIp` and `GetPort` should be merged into a single `ConnectionEndpoint` type.

- [x] `PooledObjectFactory` could be a plain `func` type. If it should be an interface then renaming looks pertinent `PooledObjectFactory.Create` => `PooledObjectFactory.CreatePoolObject`

- [x] `MultiConnectionPool` shall be moved to `src/util/sync.go`

- [x] Extend `MultiPool` type for it to become compatible with `sync.Pool`'s so that one can be replaced with the other. Add the corresponding interface and leave `sync.Pool.New` out of it .

- [ ] Write tests for `MultiConnectionPool`

- [x] `PooledObject` might be unnecessary

- [ ] When section with a given name exists implementations of `MultiPool.CreateSection` shall either fail or release objects previously allocated by initial factory .

- [ ] Instead of multiple parallel arrays , `MultiConnectionsPool` should be implemented based on a single internal struct containing all data related to a pool . This will make lookups faster and might help with implementing an interface compatible to `sync.Pool` should this internal struct be able to implement aforementioned interface. Standard `sync.Map` could be useful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.