本文整理汇总了C++中resetConnection函数的典型用法代码示例。如果您正苦于以下问题:C++ resetConnection函数的具体用法?C++ resetConnection怎么用?C++ resetConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resetConnection函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: log
bool SyncSourceFeedback::_connect(const std::string& hostName) {
if (hasConnection()) {
return true;
}
log() << "replset setting syncSourceFeedback to " << hostName << rsLog;
_connection.reset(new DBClientConnection(false, 0, OplogReader::tcp_timeout));
string errmsg;
try {
if (!_connection->connect(hostName.c_str(), errmsg) ||
(getGlobalAuthorizationManager()->isAuthEnabled() && !replAuthenticate())) {
resetConnection();
log() << "repl: " << errmsg << endl;
return false;
}
}
catch (const DBException& e) {
log() << "Error connecting to " << hostName << ": " << e.what();
resetConnection();
return false;
}
if (!replHandshake()) {
if (!supportsUpdater()) {
return connectOplogReader(hostName);
}
return false;
}
return true;
}
开发者ID:joegen,项目名称:sipx-externals,代码行数:29,代码来源:sync_source_feedback.cpp
示例2: resetConnection
bool OplogReader::connect(const HostAndPort& host) {
if (conn() == NULL || _host != host) {
resetConnection();
_conn = shared_ptr<DBClientConnection>(new DBClientConnection(false, tcp_timeout));
string errmsg;
if (!_conn->connect(host, errmsg) ||
(getGlobalAuthorizationManager()->isAuthEnabled() && !replAuthenticate(_conn.get()))) {
resetConnection();
log() << "repl: " << errmsg << endl;
return false;
}
_host = host;
}
return true;
}
开发者ID:DavidAlphaFox,项目名称:mongodb,代码行数:15,代码来源:oplogreader.cpp
示例3: ULXR_TRACE
bool Protocol::accept(int _timeout)
{
ULXR_TRACE("accept");
bool res = getConnection()->accept(_timeout);
resetConnection();
return res;
}
开发者ID:MrMC,项目名称:ulxmlrpcpp,代码行数:7,代码来源:ulxr_protocol.cpp
示例4: resetConnection
void SocksClient::sock_error(int x)
{
if(isOpen()) {
resetConnection();
setError(ErrRead);
}
else {
resetConnection(true);
if(x == BSocket::ErrHostNotFound)
setError(ErrProxyConnect);
else if(x == BSocket::ErrConnectionRefused)
setError(ErrProxyConnect);
else if(x == BSocket::ErrRead)
setError(ErrProxyNeg);
}
}
开发者ID:psi-im,项目名称:iris,代码行数:16,代码来源:socks.cpp
示例5: resetConnection
// Resets the sensor by a soft reset
uint8_t Sensirion::softReset(void)
{
// Reset communication
resetConnection();
//send RESET-command to sensor, return = 1 in case of no response
return (putByte(REG_RESET));
}
开发者ID:axello,项目名称:breathe,代码行数:8,代码来源:Sensirion.cpp
示例6: resetConnection
void ClientSyncer::connectToCore(const QVariantMap &conn) {
resetConnection();
coreConnectionInfo = conn;
if(conn["Host"].toString().isEmpty()) {
emit connectionError(tr("No Host to connect to specified."));
return;
}
Q_ASSERT(!_socket);
#ifdef HAVE_SSL
QSslSocket *sock = new QSslSocket(Client::instance());
#else
if(conn["useSsl"].toBool()) {
emit connectionError(tr("<b>This client is built without SSL Support!</b><br />Disable the usage of SSL in the account settings."));
return;
}
QTcpSocket *sock = new QTcpSocket(Client::instance());
#endif
#ifndef QT_NO_NETWORKPROXY
if(conn.contains("useProxy") && conn["useProxy"].toBool()) {
QNetworkProxy proxy((QNetworkProxy::ProxyType)conn["proxyType"].toInt(), conn["proxyHost"].toString(), conn["proxyPort"].toUInt(), conn["proxyUser"].toString(), conn["proxyPassword"].toString());
sock->setProxy(proxy);
}
#endif
_socket = sock;
connect(sock, SIGNAL(readyRead()), this, SLOT(coreHasData()));
connect(sock, SIGNAL(connected()), this, SLOT(coreSocketConnected()));
connect(sock, SIGNAL(disconnected()), this, SLOT(coreSocketDisconnected()));
connect(sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(coreSocketError(QAbstractSocket::SocketError)));
connect(sock, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(socketStateChanged(QAbstractSocket::SocketState)));
sock->connectToHost(conn["Host"].toString(), conn["Port"].toUInt());
}
开发者ID:hades,项目名称:quassel,代码行数:35,代码来源:clientsyncer.cpp
示例7: resetConnection
void HttpConnect::sock_error(int x)
{
if(d->active) {
resetConnection();
setError(ErrRead);
}
else {
resetConnection(true);
if(x == BSocket::ErrHostNotFound)
setError(ErrProxyConnect);
else if(x == BSocket::ErrConnectionRefused)
setError(ErrProxyConnect);
else if(x == BSocket::ErrRead)
setError(ErrProxyNeg);
}
}
开发者ID:psi-im,项目名称:iris,代码行数:16,代码来源:httpconnect.cpp
示例8: resetConnection
bool OplogReader::connect(const HostAndPort& host) {
if (conn() == NULL || _host != host) {
resetConnection();
_conn = std::shared_ptr<DBClientConnection>(
new DBClientConnection(false, durationCount<Seconds>(kSocketTimeout)));
std::string errmsg;
if (!_conn->connect(host, StringData(), errmsg) || !replAuthenticate(_conn.get())) {
resetConnection();
error() << errmsg;
return false;
}
_conn->setTags(transport::Session::kKeepOpen);
_host = host;
}
return true;
}
开发者ID:ShaneHarvey,项目名称:mongo,代码行数:17,代码来源:oplogreader.cpp
示例9: resetConnection
bool OplogReader::connect(const HostAndPort& host) {
if (conn() == NULL || _host != host) {
resetConnection();
_conn = shared_ptr<DBClientConnection>(
new DBClientConnection(false, durationCount<Seconds>(kSocketTimeout)));
string errmsg;
if (!_conn->connect(host, errmsg) ||
(getGlobalAuthorizationManager()->isAuthEnabled() && !replAuthenticate(_conn.get()))) {
resetConnection();
error() << errmsg << endl;
return false;
}
_conn->port().tag |= executor::NetworkInterface::kMessagingPortKeepOpen;
_host = host;
}
return true;
}
开发者ID:mongodbinc-interns,项目名称:mongo,代码行数:17,代码来源:oplogreader.cpp
示例10: resetConnection
bool OplogReader::connect(const HostAndPort& host) {
if (conn() == NULL || _host != host) {
resetConnection();
_conn = shared_ptr<DBClientConnection>(
new DBClientConnection(false, durationCount<Seconds>(kSocketTimeout)));
string errmsg;
if (!_conn->connect(host, StringData(), errmsg) || !replAuthenticate(_conn.get())) {
resetConnection();
error() << errmsg << endl;
return false;
}
_conn->port().setTag(_conn->port().getTag() |
executor::NetworkInterface::kMessagingPortKeepOpen);
_host = host;
}
return true;
}
开发者ID:GYGit,项目名称:mongo,代码行数:17,代码来源:oplogreader.cpp
示例11: fprintf
void HttpProxyPost::tls_error()
{
#ifdef PROX_DEBUG
fprintf(stderr, "HttpProxyGetStream: ssl error: %d\n", d->tls->errorCode());
#endif
resetConnection(true);
error(ErrConnectionRefused); // FIXME: bogus error
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:8,代码来源:httppoll.cpp
示例12: array
bool SyncSourceFeedback::updateUpstream() {
if (theReplSet->isPrimary()) {
// primary has no one to update to
return true;
}
BSONObjBuilder cmd;
cmd.append("replSetUpdatePosition", 1);
// create an array containing objects each member connected to us and for ourself
BSONArrayBuilder array (cmd.subarrayStart("optimes"));
OID myID = _me["_id"].OID();
{
for (map<mongo::OID, OpTime>::const_iterator itr = _slaveMap.begin();
itr != _slaveMap.end(); ++itr) {
BSONObjBuilder entry(array.subobjStart());
entry.append("_id", itr->first);
entry.append("optime", itr->second);
if (itr->first == myID) {
entry.append("config", theReplSet->myConfig().asBson());
}
else {
entry.append("config", _members[itr->first]->config().asBson());
}
entry.doneFast();
}
}
array.done();
BSONObj res;
bool ok;
try {
ok = _connection->runCommand("admin", cmd.obj(), res);
}
catch (const DBException& e) {
log() << "SyncSourceFeedback error sending update: " << e.what() << endl;
resetConnection();
return false;
}
if (!ok) {
log() << "SyncSourceFeedback error sending update, response: " << res.toString() <<endl;
resetConnection();
return false;
}
return true;
}
开发者ID:AshishThakur,项目名称:mongo,代码行数:44,代码来源:sync_source_feedback.cpp
示例13: writeData
void SocksClient::requestDeny()
{
if(d->step != StepRequest || !d->waiting)
return;
// response
d->waiting = false;
writeData(sp_set_request(d->rhost, d->rport, RET_UNREACHABLE));
resetConnection(true);
}
开发者ID:psi-im,项目名称:iris,代码行数:10,代码来源:socks.cpp
示例14: resetConnection
void HttpPoll::close()
{
if(d->state == 0 || d->closing)
return;
if(bytesToWrite() == 0)
resetConnection();
else
d->closing = true;
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:10,代码来源:httppoll.cpp
示例15: Private
HttpProxyPost::HttpProxyPost(QObject *parent)
:QObject(parent)
{
d = new Private(this);
connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected()));
connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed()));
connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead()));
connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int)));
resetConnection(true);
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:10,代码来源:httppoll.cpp
示例16: lock
bool SyncSourceFeedback::connect(const Member* target) {
boost::unique_lock<boost::mutex> lock(_connmtx);
resetConnection();
resetOplogReaderConnection();
_syncTarget = target;
if (_connect(target->fullName())) {
if (!supportsUpdater()) {
return true;
}
}
return false;
}
开发者ID:NathanZamecnik,项目名称:mongo,代码行数:12,代码来源:sync_source_feedback.cpp
示例17: Private
void SocksClient::init()
{
d = new Private(this);
connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected()));
connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed()));
connect(&d->sock, SIGNAL(delayedCloseFinished()), SLOT(sock_delayedCloseFinished()));
connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead()));
connect(&d->sock, SIGNAL(bytesWritten(qint64)), SLOT(sock_bytesWritten(qint64)));
connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int)));
resetConnection(true);
}
开发者ID:psi-im,项目名称:iris,代码行数:12,代码来源:socks.cpp
示例18: qWarning
void CoreConnection::connectToCurrentAccount()
{
if (_authHandler) {
qWarning() << Q_FUNC_INFO << "Already connected!";
return;
}
resetConnection(false);
if (currentAccount().isInternal()) {
if (Quassel::runMode() != Quassel::Monolithic) {
qWarning() << "Cannot connect to internal core in client-only mode!";
return;
}
emit startInternalCore();
InternalPeer *peer = new InternalPeer();
_peer = peer;
Client::instance()->signalProxy()->addPeer(peer); // sigproxy will take ownership
emit connectToInternalCore(peer);
setState(Connected);
return;
}
_authHandler = new ClientAuthHandler(currentAccount(), this);
connect(_authHandler, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
connect(_authHandler, SIGNAL(connectionReady()), SLOT(onConnectionReady()));
connect(_authHandler, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString)));
connect(_authHandler, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int)));
connect(_authHandler, SIGNAL(requestDisconnect(QString,bool)), SLOT(disconnectFromCore(QString,bool)));
connect(_authHandler, SIGNAL(errorMessage(QString)), SIGNAL(connectionError(QString)));
connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)), Qt::QueuedConnection);
connect(_authHandler, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString)));
connect(_authHandler, SIGNAL(encrypted(bool)), SIGNAL(encrypted(bool)));
connect(_authHandler, SIGNAL(startCoreSetup(QVariantList)), SIGNAL(startCoreSetup(QVariantList)));
connect(_authHandler, SIGNAL(coreSetupFailed(QString)), SIGNAL(coreSetupFailed(QString)));
connect(_authHandler, SIGNAL(coreSetupSuccessful()), SIGNAL(coreSetupSuccess()));
connect(_authHandler, SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)));
connect(_authHandler, SIGNAL(handleNoSslInClient(bool*)), SIGNAL(handleNoSslInClient(bool*)));
connect(_authHandler, SIGNAL(handleNoSslInCore(bool*)), SIGNAL(handleNoSslInCore(bool*)));
#ifdef HAVE_SSL
connect(_authHandler, SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)), SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)));
#endif
connect(_authHandler, SIGNAL(loginSuccessful(CoreAccount)), SLOT(onLoginSuccessful(CoreAccount)));
connect(_authHandler, SIGNAL(handshakeComplete(RemotePeer*,Protocol::SessionState)), SLOT(onHandshakeComplete(RemotePeer*,Protocol::SessionState)));
setState(Connecting);
_authHandler->connectToCore();
}
开发者ID:Bombe,项目名称:quassel,代码行数:53,代码来源:coreconnection.cpp
示例19: Private
HttpConnect::HttpConnect(QObject *parent)
:ByteStream(parent)
{
d = new Private(this);
connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected()));
connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed()));
connect(&d->sock, SIGNAL(delayedCloseFinished()), SLOT(sock_delayedCloseFinished()));
connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead()));
connect(&d->sock, SIGNAL(bytesWritten(qint64)), SLOT(sock_bytesWritten(qint64)));
connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int)));
resetConnection(true);
}
开发者ID:psi-im,项目名称:iris,代码行数:13,代码来源:httpconnect.cpp
示例20: checkErrorOccurence
void checkErrorOccurence(char *allMsg)
{
if(strstr(allMsg, "+") != NULL)
{
if(strstr(allMsg, "+RDII") != NULL)//in case of disconnection
{
stageOfConnection = 0;
stageOfInit = 0;
initStatus = FALSE;
removeInitTimerRx = FALSE;
resetConnection();
}
}
}
开发者ID:Mateusz1992,项目名称:BluetoothDriversBasedOnTimer,代码行数:14,代码来源:BluetoothDriver.c
注:本文中的resetConnection函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论