本文整理汇总了C++中resetConnection函数的典型用法代码示例。如果您正苦于以下问题:C++ resetConnection函数的具体用法?C++ resetConnection怎么用?C++ resetConnection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resetConnection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: ULXR_TRACE
bool Protocol::accept(int _timeout)
{
ULXR_TRACE("accept");
bool res = getConnection()->accept(_timeout);
resetConnection();
return res;
}
示例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);
}
}
示例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));
}
示例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());
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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);
}
示例14: resetConnection
void HttpPoll::close()
{
if(d->state == 0 || d->closing)
return;
if(bytesToWrite() == 0)
resetConnection();
else
d->closing = true;
}
示例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);
}