public class ForwardConnection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private IStreamConnection |
m_clientConnection
Stores the connection to the client.
|
private java.lang.Thread |
m_clientReadThread
Stores the instance of the data transfer thread for the client -> server
direction.
|
private boolean |
m_closeConnection
Stores whether the ForwardConnection shall be closed.
|
private ForwardScheduler |
m_parentScheduler
Stores the scheduler, which controls this ForwardConnection.
|
private IProtocolHandler |
m_serverConnection
Stores the protocol handler, which processes the data or forwards them to
the mixcascade.
|
private java.lang.Thread |
m_serverReadThread
Stores the instance of the data transfer thread for the server -> client
direction.
|
private java.lang.Thread |
m_timeoutThread
Stores the instance of the thread, which checks for a timeout on the
connection.
|
private int |
m_transferFromClient
Stores the amount of data which can be transfered on the client -> server
direction this round.
|
private int |
m_transferFromServer
Stores the amount of data which can be transfered on the server -> client
direction this round.
|
Constructor and Description |
---|
ForwardConnection(IStreamConnection a_clientConnection,
ForwardScheduler a_parentScheduler)
Creates a new ForwardConnection.
|
Modifier and Type | Method and Description |
---|---|
void |
allowTransfer(int a_transferBytes)
This method is called by the scheduler to submit, how many bytes can be
transfered on this connection in the next round.
|
void |
closeConnection()
Closes the connection.
|
int |
getAvailableBytes()
Returns the sum of available bytes (bytes which we have already received,
but waiting in the incoming buffers for the connection) for the client ->
server direction and the server -> client direction.
|
ForwardScheduler |
getParentScheduler()
Returns the scheduler for this connection.
|
java.lang.String |
toString()
Returns a string representation of this connection It's the IP and the
port of the client.
|
private IStreamConnection m_clientConnection
private IProtocolHandler m_serverConnection
private ForwardScheduler m_parentScheduler
private boolean m_closeConnection
private int m_transferFromClient
private int m_transferFromServer
private java.lang.Thread m_clientReadThread
private java.lang.Thread m_serverReadThread
private java.lang.Thread m_timeoutThread
public ForwardConnection(IStreamConnection a_clientConnection, ForwardScheduler a_parentScheduler) throws java.lang.Exception
a_clientConnection
- The Socket with the active connection to the client.a_parentScheduler
- The scheduler which controls this connection.java.lang.Exception
public int getAvailableBytes()
public ForwardScheduler getParentScheduler()
public void closeConnection()
public void allowTransfer(int a_transferBytes)
a_transferBytes
- The bytes which can be transfered on this connection in the next
round.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2023. All rights reserved.