private class AbstractTcpListener.ReadThread extends Thread
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
ReadThread()
Initializes a new ReadThread.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkForNewChannels()
Registers the channels from
AbstractTcpListener.newChannels in
AbstractTcpListener.readSelector . |
private void |
cleanup()
Closes any inactive channels registered with
AbstractTcpListener.readSelector . |
private void |
processFirstDatagram(byte[] bytesRead,
AbstractTcpListener.ChannelDesc channel,
SelectionKey key)
Process the first RFC4571-framed datagram read from a socket.
|
private void |
readFromChannel(AbstractTcpListener.ChannelDesc channel,
SelectionKey key)
Tries to read, without blocking, from channel to its
buffer.
|
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public ReadThread() throws IOException
IOException
- if the selector to be used fails to open.private void checkForNewChannels()
AbstractTcpListener.newChannels
in
AbstractTcpListener.readSelector
.private void cleanup()
AbstractTcpListener.readSelector
.
A channel is considered inactive if it hasn't been available for
reading for
MuxServerSocketChannelFactory.SOCKET_CHANNEL_READ_TIMEOUT
milliseconds.private void readFromChannel(AbstractTcpListener.ChannelDesc channel, SelectionKey key)
#processFirstDatagram(byte[], ChannelDesc, SelectionKey)
channel
- the SocketChannel to read from.key
- the SelectionKey associated with
channel, which is to be canceled in case no further
reading is required from the channel.private void processFirstDatagram(byte[] bytesRead, AbstractTcpListener.ChannelDesc channel, SelectionKey key) throws IOException, IllegalStateException
AbstractTcpListener.acceptSession(Socket, String, DatagramPacket)
.bytesRead
- bytes to be processedchannel
- the SocketChannel to read from.key
- the SelectionKey associated with
channel, which is to be canceled in case no further
reading is required from the channel.IOException
- if the datagram does not contain s STUN Binding
Request with a USERNAME attribute.IllegalStateException
- if the session for the extracted
username fragment cannot be accepted for implementation reasons
(e.g. no ICE Agent with the given local ufrag is found).Copyright © 2018. All rights reserved.