Esempio n. 1
0
	    void SslConnection::open()
        {
			auto self = shared_from_this();
			auto query = endpoints();

			_socket.set_verify_mode(ssl::verify_peer);

			_socket.set_verify_callback([this](bool preverified, ssl::verify_context &ctx) -> bool {
				return verifyCertificate(preverified, ctx);
			});

            _resolver.async_resolve(query, boost::bind(
                    &SslConnection::handleResolve, this, pl::error, pl::iterator));
		}
Esempio n. 2
0
  qi::FutureSync<unsigned int> Session::registerService(const std::string &name, qi::AnyObject obj)
  {
    if (!obj)
      return makeFutureError<unsigned int>("registerService: Object is empty");
    if (endpoints().empty()) {
      qi::Url listeningAddress("tcp://0.0.0.0:0");
      qiLogVerbose() << listeningAddress.str() << "." << std::endl;
      listen(listeningAddress);
    }

    if (!isConnected()) {
      return qi::makeFutureError< unsigned int >("Session not connected.");
    }

    return _p->_serverObject.registerService(name, obj);
  }
Esempio n. 3
0
/*
 statistics to be displayed from non-debug (release) compiles of command-line test harnesses.
 */
void udp::statistics() {
	printf("############       STATISTICS     #############################\n");
	printf("###############################################################\n");

	printf("SOCKET   \t %d\n", m_sock);
	printf("INSTANCE \t %d of %d\n", m_instance, m_last_instance);

	printf("last bytes sent            \t %ld\n", m_last_bytes_sent);
	printf("     bytes sent            \t %ld\n", m_bytes_sent);

	printf("last bytes received        \t %ld\n", m_last_bytes_received);
	printf("     bytes received        \t %ld\n", m_bytes_received);

	printf("ping                       \t %ld ms\n", ping());

	printf("send packets               \t %d\n", m_send_packets);
	printf("recv packets               \t %d\n", m_recv_packets);

	if (m_last_timeout > 0.0) {
		printf("**TIMEDOUT**               \t %lf\n", m_last_timeout);
	}

	printf("log:\n%S\n", log.Logs());

	printf("BUFFERLENGTHS##################################################\n");
	size_t sendlength;
	size_t recvlength;
	size_t buffersize;
	size_t messagelength;
	bufferlengths(sendlength, recvlength, buffersize, messagelength);
	printf("sendlength\t%d\n", sendlength);
	printf("recvlength\t%d\n", recvlength);
	printf("buffersize\t%d\n", buffersize);
	printf("messagelength\t%d\n", messagelength);

	printf("ENDPOINTS######################################################\n");
	int lp;
	int rp;
	char *lip = NULL;
	char *rip = NULL;
	endpoints(lip, lp, rip, rp);
	printf("local \t %s:%d\n", lip, lp);
	printf("remote\t %s:%d\n", rip, rp);

	printf("###############################################################\n");
}
Esempio n. 4
0
 qi::Url Session::url() const {
   if (_p->_sdClient.isLocal())
     return endpoints()[0];
   else
     return _p->_sdClient.url();
 }
Esempio n. 5
0
	Interval& operator -=(const Interval<U>& v){ endpoints(min()-v.max(), max()-v.min()); return *this; }
Esempio n. 6
0
	Interval(const T& min, const T& max)
	{ endpoints(min,max); }
Esempio n. 7
0
	/// Set minimum endpoint
	Interval& min(const T& v){ return endpoints(v, max()); }
Esempio n. 8
0
	/// Set maximum endpoint
	Interval& max(const T& v){ return endpoints(min(), v); }
 service<T>
 create(std::string name) {
     return service<T>(logger(), std::move(name), endpoints(), next());
 }