Package com.caucho.vfs

Examples of com.caucho.vfs.QSocket


  {
    TcpSocketLink startConn = _idleConn.allocate();
   
    if (startConn == null) {
      int connId = _connectionCount.incrementAndGet();
      QSocket socket = _serverSocket.createSocket();

      startConn = new TcpSocketLink(connId, this, socket);
    }
   
    _activeConnectionSet.add(startConn);
View Full Code Here


   * Poll the socket to test for an end-of-file for a comet socket.
   */
  @Friend(TcpSocketLinkListener.class)
  boolean isReadEof()
  {
    QSocket socket = _socket;

    if (socket == null) {
      return true;
    }

    try {
      StreamImpl s = socket.getStream();

      int len = s.readNonBlock(_testBuffer, 0, 0);

      if (len >= 0 || len == ReadStream.READ_TIMEOUT)
        return false;
View Full Code Here

      return;
    }

    TcpSocketLinkListener port = getListener();
   
    QSocket socket = _socket;
   
    // detach any comet
    /*
    if (state.isComet() || state.isCometSuspend())
      port.cometDetach(this);
      */

    try {
      getRequest().onCloseConnection();
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
    }

    if (log.isLoggable(Level.FINER)) {
      if (port != null)
        log.finer(dbgId() + "closing connection " + this
                  + ", total=" + port.getConnectionCount());
      else
        log.finer(dbgId() + "closing connection " + this);
    }

    try {
      getWriteStream().close();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }

    try {
      getReadStream().close();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }

    if (port != null) {
      port.closeSocket(socket);
    }

    try {
      socket.close();
    } catch (Throwable e) {
      log.log(Level.FINER, e.toString(), e);
    }
  }
View Full Code Here

    TcpSocketLink tcpConn = (TcpSocketLink) conn;
   
    if (! conn.isSecure())
      return;

    QSocket socket = tcpConn.getSocket();

    String cipherSuite = socket.getCipherSuite();
    request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite);

    int keySize = socket.getCipherBits();
    if (keySize != 0)
      request.setAttribute("javax.servlet.request.key_size",
                           new Integer(keySize));

    try {
      X509Certificate []certs = socket.getClientCertificates();
      if (certs != null && certs.length > 0) {
        request.setAttribute("javax.servlet.request.X509Certificate",
                             certs); //spec mandates array
      }
    } catch (Exception e) {
View Full Code Here

  /**
   * Poll the socket to test for an end-of-file for a comet socket.
   */
  public boolean isReadEof()
  {
    QSocket socket = _socket;

    if (socket == null)
      return true;

    try {
      StreamImpl s = socket.getStream();

      int len = s.read(_testBuffer, 0, 0);

      return len < 0;
    } catch (Exception e) {
View Full Code Here

  /**
   * Closes on shutdown.
   */
  public void closeOnShutdown()
  {
    QSocket socket = _socket;

    if (socket != null) {
      try {
        socket.close();
      } catch (Throwable e) {
        log.log(Level.FINE, e.toString(), e);
      }

      // Thread.yield();
View Full Code Here

    _state = _state.toClosed(this);

    if (state.isClosed())
      return;

    QSocket socket = _socket;

    // detach any comet
    if (state.isComet() || state.isCometSuspend())
      getPort().cometDetach(this);

    getRequest().onCloseConnection();

    AsyncController controller = _controller;
    _controller = null;

    if (controller != null)
      controller.closeImpl();

    SocketLinkListener port = getPort();

    if (log.isLoggable(Level.FINER)) {
      if (port != null)
        log.finer(dbgId() + " closing connection " + this + ", total=" + port.getConnectionCount());
      else
        log.finer(dbgId() + " closing connection " + this);
    }

    try {
      getWriteStream().close();
    } catch (Throwable e) {
      log.log(Level.FINE, e.toString(), e);
    }

    try {
      getReadStream().close();
    } catch (Throwable e) {
      log.log(Level.FINE, e.toString(), e);
    }

    if (socket != null) {
      getPort().closeSocket(socket);

      try {
        socket.close();
      } catch (Throwable e) {
        log.log(Level.FINE, e.toString(), e);
      }
    }
  }
View Full Code Here

        if (startConn != null) {
          startConn.toInit(); // change to the init/ready state
        }
        else {
          int connId = _connectionCount.incrementAndGet();
          QSocket socket = _serverSocket.createSocket();
          startConn = new TcpSocketLink(connId, this, socket);
        }

        _startThreadCount.incrementAndGet();
        _activeConnectionCount.incrementAndGet();
View Full Code Here

    TcpSocketLink tcpConn = (TcpSocketLink) conn;
   
    if (! conn.isSecure())
      return;

    QSocket socket = tcpConn.getSocket();

    String cipherSuite = socket.getCipherSuite();
    request.setAttribute("javax.servlet.request.cipher_suite", cipherSuite);

    int keySize = socket.getCipherBits();
    if (keySize != 0)
      request.setAttribute("javax.servlet.request.key_size",
                           new Integer(keySize));

    try {
      X509Certificate []certs = socket.getClientCertificates();
      if (certs != null && certs.length > 0) {
        request.setAttribute("javax.servlet.request.X509Certificate",
                             certs); //spec mandates array
        request.setAttribute(com.caucho.security.AbstractLogin.LOGIN_NAME,
                             certs[0].getSubjectDN());
View Full Code Here

    TcpSocketLink tcpConn = (TcpSocketLink) getConnection();

    if (tcpConn == null || ! tcpConn.isSecure())
      return null;

    QSocket socket = tcpConn.getSocket(); // XXX:
    /*
    if (! (socket instanceof SSLSocket))
      return null;

    SSLSession sslSession = ((SSLSocket) socket).getSession();
View Full Code Here

TOP

Related Classes of com.caucho.vfs.QSocket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.