ztsdb
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
net::NetHandler Struct Reference

Public Member Functions

 NetHandler (const std::string ip_addr, int port_p, int data_out_fd, int signalling_out_fd, size_t datalist_max_size=1e5, size_t siglist_max_size=10)
 
void run (volatile bool &stop)
 
ssize_t send (Global::conn_id_t id, char *buf, size_t len)
 Send 'buf' to peer 'id'.
 
bool get_data (Global::conn_id_t &id, Buf &buf)
 
bool get_sig (Global::conn_id_t &id, SignallingMgt::Status &st)
 
Global::conn_id_t connect (const std::string &ip, int port)
 
void disconnect (Global::conn_id_t id)
 
const zcore::NetStatsgetNetStats ()
 
void resetNetStats ()
 
zcore::NetInfo getNetInfo () const
 

Public Attributes

std::atomic_uint_fast64_t ready
 

Static Public Attributes

static constexpr time_point::duration BUF_TIME_TO_LIVE = 60s
 

Constructor & Destructor Documentation

◆ NetHandler()

net::NetHandler::NetHandler ( const std::string  ip_addr,
int  port_p,
int  data_out_fd,
int  signalling_out_fd,
size_t  datalist_max_size = 1e5,
size_t  siglist_max_size = 10 
)
Todo:
figure out what TCP params we need and add them to the options setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one)); set up keepalive? http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/programming.html

Member Function Documentation

◆ connect()

Global::conn_id_t net::NetHandler::connect ( const std::string &  ip,
int  port 
)

Establish TCP connection to a given addres/port. Either returns the created 'conn_id_t' or throws.

◆ disconnect()

void net::NetHandler::disconnect ( Global::conn_id_t  id)

Disconnect the TCP connection (if still up), take out 'id' from the mappings and inform the upper layer.


The documentation for this struct was generated from the following files: