---
title: llarp::OutboundSessionMaker

---

# llarp::OutboundSessionMaker





Inherits from [llarp::IOutboundSessionMaker](Classes/structllarp_1_1IOutboundSessionMaker.md)

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::function< void(void)> | **[Work_t](Classes/structllarp_1_1OutboundSessionMaker.md#using-work-t)**  |
| using std::function< void(Work_t)> | **[WorkerFunc_t](Classes/structllarp_1_1OutboundSessionMaker.md#using-workerfunc-t)**  |
| using std::list< RouterCallback > | **[CallbacksQueue](Classes/structllarp_1_1OutboundSessionMaker.md#using-callbacksqueue)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[~OutboundSessionMaker](Classes/structllarp_1_1OutboundSessionMaker.md#function-~outboundsessionmaker)**() override =default |
| virtual bool | **[OnSessionEstablished](Classes/structllarp_1_1OutboundSessionMaker.md#function-onsessionestablished)**([ILinkSession](Classes/structllarp_1_1ILinkSession.md) * session) override |
| virtual void | **[OnConnectTimeout](Classes/structllarp_1_1OutboundSessionMaker.md#function-onconnecttimeout)**([ILinkSession](Classes/structllarp_1_1ILinkSession.md) * session) override |
| virtual void | **[CreateSessionTo](Classes/structllarp_1_1OutboundSessionMaker.md#function-createsessionto)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & router, RouterCallback on_result) override |
| virtual void | **[CreateSessionTo](Classes/structllarp_1_1OutboundSessionMaker.md#function-createsessionto)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) & rc, RouterCallback on_result) override |
| virtual bool | **[HavePendingSessionTo](Classes/structllarp_1_1OutboundSessionMaker.md#function-havependingsessionto)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & router) const override |
| virtual void | **[ConnectToRandomRouters](Classes/structllarp_1_1OutboundSessionMaker.md#function-connecttorandomrouters)**(int numDesired) override |
| virtual util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1OutboundSessionMaker.md#function-extractstatus)**() const override |
| virtual bool | **[ShouldConnectTo](Classes/structllarp_1_1OutboundSessionMaker.md#function-shouldconnectto)**(const [RouterID](Classes/structllarp_1_1RouterID.md) & router) const override |
| void | **[Init](Classes/structllarp_1_1OutboundSessionMaker.md#function-init)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * router, [ILinkManager](Classes/structllarp_1_1ILinkManager.md) * linkManager, [I_RCLookupHandler](Classes/structllarp_1_1I__RCLookupHandler.md) * rcLookup, [Profiling](Classes/structllarp_1_1Profiling.md) * profiler, EventLoop_ptr loop, WorkerFunc_t work) |
| void | **[SetOurRouter](Classes/structllarp_1_1OutboundSessionMaker.md#function-setourrouter)**([RouterID](Classes/structllarp_1_1RouterID.md) r) |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| size_t | **[minConnectedRouters](Classes/structllarp_1_1OutboundSessionMaker.md#variable-minconnectedrouters)** <br>always maintain this many connections to other routers  |
| size_t | **[maxConnectedRouters](Classes/structllarp_1_1OutboundSessionMaker.md#variable-maxconnectedrouters)** <br>hard upperbound limit on the number of router to router connections  |

## Additional inherited members

**Public Functions inherited from [llarp::IOutboundSessionMaker](Classes/structllarp_1_1IOutboundSessionMaker.md)**

|                | Name           |
| -------------- | -------------- |
| virtual | **[~IOutboundSessionMaker](Classes/structllarp_1_1IOutboundSessionMaker.md#function-~ioutboundsessionmaker)**() =default |


## Public Types Documentation

### using Work_t

```cpp
using llarp::OutboundSessionMaker::Work_t =  std::function<void(void)>;
```


### using WorkerFunc_t

```cpp
using llarp::OutboundSessionMaker::WorkerFunc_t =  std::function<void(Work_t)>;
```


### using CallbacksQueue

```cpp
using llarp::OutboundSessionMaker::CallbacksQueue =  std::list<RouterCallback>;
```


## Public Functions Documentation

### function ~OutboundSessionMaker

```cpp
~OutboundSessionMaker() override =default
```


### function OnSessionEstablished

```cpp
virtual bool OnSessionEstablished(
    ILinkSession * session
) override
```


**Reimplements**: [llarp::IOutboundSessionMaker::OnSessionEstablished](Classes/structllarp_1_1IOutboundSessionMaker.md#function-onsessionestablished)


### function OnConnectTimeout

```cpp
virtual void OnConnectTimeout(
    ILinkSession * session
) override
```


**Reimplements**: [llarp::IOutboundSessionMaker::OnConnectTimeout](Classes/structllarp_1_1IOutboundSessionMaker.md#function-onconnecttimeout)


### function CreateSessionTo

```cpp
virtual void CreateSessionTo(
    const RouterID & router,
    RouterCallback on_result
) override
```


**Reimplements**: [llarp::IOutboundSessionMaker::CreateSessionTo](Classes/structllarp_1_1IOutboundSessionMaker.md#function-createsessionto)


### function CreateSessionTo

```cpp
virtual void CreateSessionTo(
    const RouterContact & rc,
    RouterCallback on_result
) override
```


**Reimplements**: [llarp::IOutboundSessionMaker::CreateSessionTo](Classes/structllarp_1_1IOutboundSessionMaker.md#function-createsessionto)


### function HavePendingSessionTo

```cpp
virtual bool HavePendingSessionTo(
    const RouterID & router
) const override
```


**Reimplements**: [llarp::IOutboundSessionMaker::HavePendingSessionTo](Classes/structllarp_1_1IOutboundSessionMaker.md#function-havependingsessionto)


### function ConnectToRandomRouters

```cpp
virtual void ConnectToRandomRouters(
    int numDesired
) override
```


**Reimplements**: [llarp::IOutboundSessionMaker::ConnectToRandomRouters](Classes/structllarp_1_1IOutboundSessionMaker.md#function-connecttorandomrouters)


### function ExtractStatus

```cpp
virtual util::StatusObject ExtractStatus() const override
```


**Reimplements**: [llarp::IOutboundSessionMaker::ExtractStatus](Classes/structllarp_1_1IOutboundSessionMaker.md#function-extractstatus)


### function ShouldConnectTo

```cpp
virtual bool ShouldConnectTo(
    const RouterID & router
) const override
```


**Reimplements**: [llarp::IOutboundSessionMaker::ShouldConnectTo](Classes/structllarp_1_1IOutboundSessionMaker.md#function-shouldconnectto)


### function Init

```cpp
void Init(
    AbstractRouter * router,
    ILinkManager * linkManager,
    I_RCLookupHandler * rcLookup,
    Profiling * profiler,
    EventLoop_ptr loop,
    WorkerFunc_t work
)
```


### function SetOurRouter

```cpp
inline void SetOurRouter(
    RouterID r
)
```


## Public Attributes Documentation

### variable minConnectedRouters

```cpp
size_t minConnectedRouters = 4;
```

always maintain this many connections to other routers 

### variable maxConnectedRouters

```cpp
size_t maxConnectedRouters = 6;
```

hard upperbound limit on the number of router to router connections 

-------------------------------

Updated on 2023-01-06 at 19:35:06 +0000