S3FC project page | S3FC home page |
Inheritance diagram for s3_txport_tcp_rx_task:
Public Methods | |
void | set_terminate () |
Post to the termination semaphore. More... | |
std::string | get_message () const |
Return last error message returned by the client. More... | |
std::string | get_client_ip () const |
Returns the IP address of the remote client. More... | |
bool | connected () const |
Returns true if the client is still connected. More... | |
T_Socket * | get_socket () |
Returns the socket associated with the client. More... | |
void | main_loop () |
Function that is invoked as the main loop in its own thread. More... | |
Protected Methods | |
void | cleanup () |
Cleanup handler. More... | |
s3_txport_tcp_rx_task (s3_txport_client_id a_id, T_Socket *a_sock, const std::string &a_client_ip, s3_txport_tcp< T_Data, T_Socket > *a_parent) | |
~s3_txport_tcp_rx_task () | |
Destructor just disconnects the pn from our semaphore. More... | |
Private Methods | |
void | set_message (const std::string m) |
Private Attributes | |
s3_semaphore | sem |
"select()" semaphore. More... | |
s3_pack_buffer | b |
Streamable object for transmission. More... | |
T_Socket * | sock |
The active socket we read from. More... | |
s3_txport_client_id | id |
The ID assigned to this thread. More... | |
std::string | client_ip |
The IP address of the client. More... | |
std::string | message |
The last message returned from the system. More... | |
bool | is_connected |
True if this client is still connected. More... | |
s3_txport_tcp< T_Data, T_Socket > * | parent |
Pointer to parent txport instance. More... | |
s3_semaphore | terminate |
Set to true if we must terminate the thread. More... | |
s3_periodic_notifier | pn |
Periodic notifier to tick system over. More... | |
s3_mutex | c_lock |
Lock for the connection state. More... | |
Friends | |
class | s3_txport_tcp< T_Data, T_Socket > |
This object is the thread associated with each client connection. It can be inspected for all details regarding the connection. It contains a semaphore indicating that this socket is in a critical section, not just this thread. This is to prevent a race condition where a small gap exists between when the connection is tested and data is transmitted in the tx thread. The semaphore is here because this structure is the authority for the connection. Details of the race are documented where it occurs.
Definition at line 289 of file s3_txport_tcp.tcc.
|
Definition at line 345 of file s3_txport_tcp.tcc. References client_ip, id, is_connected, message, s3_txport_client_id, sock, and s3_periodic_notifier::subscribe. |
|
Destructor just disconnects the pn from our semaphore.
Definition at line 356 of file s3_txport_tcp.tcc. References s3_periodic_notifier::unsubscribe. |
|
Cleanup handler.
This is called before killing the thread, as part of the termination process, once a cancellation request has been received - from Reimplemented from s3_thread_base. Definition at line 320 of file s3_txport_tcp.tcc. References s3_periodic_notifier::disable, s3_txport_tcp::dying_tasklets, id, is_connected, s3_mutex::lock, s3_thread_base::lock_state, s3_growable_fifo_queue< s3_txport_client_id >::push, s3_txport_tcp::rx_queue, S3FC_DBG, sock, s3_mutex::unlock, and s3_thread_base::unlock_state. |
|
Returns true if the client is still connected.
Definition at line 381 of file s3_txport_tcp.tcc. References is_connected, s3_mutex::lock, and s3_mutex::unlock. |
|
Returns the IP address of the remote client.
Definition at line 375 of file s3_txport_tcp.tcc. References client_ip. |
|
Return last error message returned by the client.
Definition at line 369 of file s3_txport_tcp.tcc. References message. |
|
Returns the socket associated with the client.
Definition at line 391 of file s3_txport_tcp.tcc. References sock. |
|
Function that is invoked as the main loop in its own thread. Override this in derived class.
Implements s3_thread_base. Definition at line 396 of file s3_txport_tcp.tcc. References s3_fifo_queue< s3_txport_data< T_Data > >::close_input, s3_event_dispatcher< s3_txport_event >::dispatch_event, s3_periodic_notifier::enable, s3_pack_buffer::get_buffer, id, s3_txport_event::metadata, s3_fifo_queue< s3_txport_data< T_Data > >::nbl_open_input, s3_pack_buffer::reset, s3_txport_tcp::rx_queue, S3FC_DBG, s3_pack_buffer::set_capacity, set_message, sock, s3_semaphore::try_wait, s3_streamable::unpack, and s3_semaphore::wait. |
|
Definition at line 314 of file s3_txport_tcp.tcc. References message. Referenced by main_loop. |
|
Post to the termination semaphore.
Definition at line 363 of file s3_txport_tcp.tcc. References s3_semaphore::post. |
|
Definition at line 477 of file s3_txport_tcp.tcc. |
|
Streamable object for transmission.
Definition at line 294 of file s3_txport_tcp.tcc. |
|
Lock for the connection state.
Definition at line 312 of file s3_txport_tcp.tcc. |
|
The IP address of the client.
Definition at line 300 of file s3_txport_tcp.tcc. Referenced by get_client_ip, and s3_txport_tcp_rx_task. |
|
The ID assigned to this thread.
Definition at line 298 of file s3_txport_tcp.tcc. Referenced by cleanup, main_loop, and s3_txport_tcp_rx_task. |
|
True if this client is still connected.
Definition at line 304 of file s3_txport_tcp.tcc. Referenced by cleanup, connected, and s3_txport_tcp_rx_task. |
|
The last message returned from the system.
Definition at line 302 of file s3_txport_tcp.tcc. Referenced by get_message, s3_txport_tcp_rx_task, and set_message. |
|
Pointer to parent txport instance.
Definition at line 306 of file s3_txport_tcp.tcc. |
|
Periodic notifier to tick system over.
Definition at line 310 of file s3_txport_tcp.tcc. |
|
"select()" semaphore.
Definition at line 292 of file s3_txport_tcp.tcc. |
|
The active socket we read from.
Definition at line 296 of file s3_txport_tcp.tcc. Referenced by cleanup, get_socket, main_loop, and s3_txport_tcp_rx_task. |
|
Set to true if we must terminate the thread.
Definition at line 308 of file s3_txport_tcp.tcc. |
Send comments to: s3fc@stonethree.com |
|