neoneo-go/pkg/connmgr
decentralisedkev e12255dd73
[connmgr] Refactor Connmgr (#205)
* [connmgr]

- Refactor Connmgr
- Remove un-needed async code
- Add comment for Request
2019-03-21 23:18:02 +00:00
..
config.go [connmgr] Refactor Connmgr (#205) 2019-03-21 23:18:02 +00:00
connmgr.go [connmgr] Refactor Connmgr (#205) 2019-03-21 23:18:02 +00:00
connmgr_test.go [connmgr] Refactor Connmgr (#205) 2019-03-21 23:18:02 +00:00
readme.md [connmgr] Refactor Connmgr (#205) 2019-03-21 23:18:02 +00:00
request.go [connmgr] Refactor Connmgr (#205) 2019-03-21 23:18:02 +00:00

Package - Connection Manager

Responsibility

  • Manages the active, failed and pending connections for the node.

Features

  • Takes an Request, dials it and logs information based on the connectivity.

  • Retry failed connections.

  • Removable address source. The connection manager does not manage addresses, only connections.

Usage

The following methods are exposed from the Connection manager:

  • Connect(r *Request) : This takes a Request object and connects to it. It follow the same logic as NewRequest() however instead of getting the address from the datasource given upon initialisation, you directly feed the address you want to connect to.

  • Disconnect(addrport string) : Given an address:port, this will disconnect it, close the connection and remove it from the connected and pending list, if it was there.