Search in sources :

Example 1 with Sock

use of tezc.base.transport.sock.Sock in project tezcRaft by tezc.

the class IOWorker method handleAcceptEvent.

/**
 * New connection arrived
 *
 * @param listener Listener object which has accepted the connection
 */
@Override
public void handleAcceptEvent(Listener listener) {
    Sock sock;
    try {
        sock = listener.accept();
    } catch (Exception e) {
        logError(e);
        return;
    }
    try {
        logInfo(listener.toString(), " accepted : ", sock);
        sock.register(poll.getSelector(), SelectionKey.OP_READ);
        sock.handshake();
    } catch (Exception e) {
        sock.close();
        logInfo("Disconnected : ", sock.toString());
        return;
    }
    pendings.add(new Connection(this, sock, null));
}
Also used : Sock(tezc.base.transport.sock.Sock) Connection(tezc.core.connection.Connection)

Aggregations

Sock (tezc.base.transport.sock.Sock)1 Connection (tezc.core.connection.Connection)1