}
/*!
+ Returns the pause mode of this socket
+ */
+QAbstractSocket::PauseModes QWebSocket::pauseMode() const
+{
+ return d_ptr->pauseMode();
+}
+
+/*!
Returns the peer address
*/
QHostAddress QWebSocket::peerAddress() const
}
/*!
- Sets the proxy to \a networkProxy
+ Continues data transfer on the socket. This method should only be used after the socket
+ has been set to pause upon notifications and a notification has been received.
+ The only notification currently supported is sslErrors().
+ Calling this method if the socket is not paused results in undefined behavior.
+
+ \sa pauseMode() and setPauseMode()
*/
-void QWebSocket::setProxy(const QNetworkProxy &networkProxy)
+void QWebSocket::resume()
{
- d_ptr->setProxy(networkProxy);
+ d_ptr->resume();
+}
+
+/*!
+ Controls whether to pause upon receiving a notification. The \a pauseMode parameter specifies
+ the conditions in which the socket should be paused.
+ The only notification currently supported is sslErrors().
+ If set to PauseOnSslErrors, data transfer on the socket will be paused
+ and needs to be enabled explicitly again by calling resume().
+ By default, this option is set to PauseNever. This option must be called
+ before connecting to the server, otherwise it will result in undefined behavior.
+
+ \sa pauseMode() and resume()
+ */
+void QWebSocket::setPauseMode(QAbstractSocket::PauseModes pauseMode)
+{
+ d_ptr->setPauseMode(pauseMode);
}
/**
bool isValid();
QHostAddress localAddress() const;
quint16 localPort() const;
+ QAbstractSocket::PauseModes pauseMode() const;
QHostAddress peerAddress() const;
QString peerName() const;
quint16 peerPort() const;
#endif
qint64 readBufferSize() const;
void setReadBufferSize(qint64 size);
+
+ void resume();
+ void setPauseMode(QAbstractSocket::PauseModes pauseMode);
+
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value);
QVariant socketOption(QAbstractSocket::SocketOption option);
QAbstractSocket::SocketState state() const;
/*!
\internal
*/
+QAbstractSocket::PauseModes QWebSocketPrivate::pauseMode() const
+{
+ QAbstractSocket::PauseModes mode = QAbstractSocket::PauseNever;
+ if (m_pSocket)
+ {
+ mode = m_pSocket->pauseMode();
+ }
+ return mode;
+}
+
+/*!
+ \internal
+ */
QHostAddress QWebSocketPrivate::peerAddress() const
{
QHostAddress peer;
/*!
\internal
*/
+void QWebSocketPrivate::resume()
+{
+ if (m_pSocket)
+ {
+ m_pSocket->resume();
+ }
+}
+
+/*!
+ \internal
+ */
+void QWebSocketPrivate::setPauseMode(QAbstractSocket::PauseModes pauseMode)
+{
+ if (m_pSocket)
+ {
+ m_pSocket->setPauseMode(pauseMode);
+ }
+}
+
+/*!
+ \internal
+ */
void QWebSocketPrivate::setProxy(const QNetworkProxy &networkProxy)
{
if (m_pSocket)
bool isValid();
QHostAddress localAddress() const;
quint16 localPort() const;
+ QAbstractSocket::PauseModes pauseMode() const;
QHostAddress peerAddress() const;
QString peerName() const;
quint16 peerPort() const;
void setProxy(const QNetworkProxy &networkProxy);
#endif
qint64 readBufferSize() const;
+ void resume();
+ void setPauseMode(QAbstractSocket::PauseModes pauseMode);
void setReadBufferSize(qint64 size);
void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value);
QVariant socketOption(QAbstractSocket::SocketOption option);
*/
/*!
+ \fn void WebSocketServer::acceptError(QAbstractSocket::SocketError socketError)
+ This signal is emitted when accepting a new connection results in an error.
+ The \a socketError parameter describes the type of error that occurred
+
+ \sa pauseAccepting() and resumeAccepting().
+*/
+
+/*!
\fn void WebSocketServer::newConnection()
This signal is emitted every time a new connection is available.
}
/*!
+ Pauses incoming new connections. Queued connections will remain in queue.
+ \sa resumeAccepting()
+ */
+void QWebSocketServer::pauseAccepting()
+{
+ d_ptr->pauseAccepting();
+}
+
#ifndef QT_NO_NETWORKPROXY
/*!
Returns the network proxy for this socket. By default QNetworkProxy::DefaultProxy is used.
d_ptr->setProxy(networkProxy);
}
#endif
+/*!
+ Resumes accepting new connections.
+ \sa pauseAccepting()
+ */
+void QWebSocketServer::resumeAccepting()
+{
+ d_ptr->resumeAccepting();
+}
+
+/*!
Returns the server's address if the server is listening for connections; otherwise returns QHostAddress::Null.
\sa serverPort() and listen().
virtual bool isOriginAllowed(const QString &origin) const;
Q_SIGNALS:
+ void acceptError(QAbstractSocket::SocketError socketError);
void newConnection();
private:
return pWebSocket;
}
+/*!
+ \internal
+ */
+void QWebSocketServerPrivate::pauseAccepting()
+{
+ m_pTcpServer->pauseAccepting();
+}
+
#ifndef QT_NO_NETWORKPROXY
/*!
\internal
/*!
\internal
*/
+void QWebSocketServerPrivate::resumeAccepting()
+{
+ m_pTcpServer->resumeAccepting();
+}
+
+/*!
+ \internal
+ */
QHostAddress QWebSocketServerPrivate::serverAddress() const
{
return m_pTcpServer->serverAddress();
bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
int maxPendingConnections() const;
virtual QWebSocket *nextPendingConnection();
+ void pauseAccepting();
#ifndef QT_NO_NETWORKPROXY
QNetworkProxy proxy() const;
void setProxy(const QNetworkProxy &networkProxy);
#endif
+ void resumeAccepting();
QHostAddress serverAddress() const;
QAbstractSocket::SocketError serverError() const;
quint16 serverPort() const;