本文整理汇总了C++中TraceS函数的典型用法代码示例。如果您正苦于以下问题:C++ TraceS函数的具体用法?C++ TraceS怎么用?C++ TraceS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TraceS函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TraceS
int TCPSocket::send(const char* data, std::size_t len, const net::Address& /* peerAddress */, int /* flags */)
{
//assert(len <= net::MAX_TCP_PACKET_SIZE); // libuv handles this for us
TraceS(this) << "Send: " << len << endl;
assert(Thread::currentID() == tid());
#if 0
if (len < 300)
TraceS(this) << "Send: " << len << ": " << std::string(data, len) << endl;
else {
std::string str(data, len);
TraceS(this) << "Send: START: " << len << ": " << str.substr(0, 100) << endl;
TraceS(this) << "Send: END: " << len << ": " << str.substr(str.length() - 100, str.length()) << endl;
}
#endif
if (!Stream::write(data, len)) {
WarnL << "Send error" << endl;
return -1;
}
// R is -1 on error, otherwise return len
// TODO: Return native error code?
return len;
}
示例2: TraceS
void ClientConnection::onSocketConnect()
{
TraceS(this) << "On connect" << endl;
// Set the connection to active
_active = true;
// Emit the connect signal so raw connections like
// websockets can kick off the data flow
Connect.emit(this);
// Start the outgoing send stream if there are
// any queued packets or adapters attached
// startInputStream();
// startOutputStream();
// Flush queued packets
if (!_outgoingBuffer.empty()) {
for (const auto & packet : _outgoingBuffer) {
Outgoing.write(packet.c_str(), packet.length());
}
_outgoingBuffer.clear();
}
// Send the outgoing HTTP header if it hasn't already been sent.
// Note the first call to socket().send() will flush headers.
// Note if there are stream adapters we wait for the stream to push
// through any custom headers. See ChunkedAdapter::emitHeader
if (Outgoing.numAdapters() == 0) {
TraceS(this) << "On connect: Send header" << endl;
sendHeader();
}
}
示例3: TraceS
void SSLSocket::onConnect(uv_connect_t* handle, int status)
{
TraceS(this) << "On connect" << endl;
if (status) {
setUVError("SSL connect error", status);
return;
}
else
readStart();
SSL* ssl = SSL_new(_context->sslContext());
// TODO: Automatic SSL session handling.
// Maybe add a stored session to the network manager.
if (_session)
SSL_set_session(ssl, _session->sslSession());
SSL_set_connect_state(ssl);
SSL_do_handshake(ssl);
_sslAdapter.init(ssl);
_sslAdapter.flush();
//emitConnect();
onSocketConnect();
TraceS(this) << "On connect: OK" << endl;
}
示例4: defined
bool DeviceManager::getAudioDevices(bool input, std::vector<Device>& devs)
{
devs.clear();
#if defined(ANDROID)
// Under Android, we don't access the device file directly.
// Arbitrary use 0 for the mic and 1 for the output.
// These ids are used in MediaEngine::SetSoundDevices(in, out);
// The strings are for human consumption.
if (input) {
devs.push_back(Device("audioin", "audiorecord", 0));
} else {
devs.push_back(Device("audioout", "audiotrack", 1));
}
return true;
#elif defined(HAVE_RTAUDIO)
// Since we are using RtAudio for audio capture it's best to
// use RtAudio to enumerate devices to ensure indexes match.
RtAudio audio;
// Determine the number of devices available
auto ndevices = audio.getDeviceCount();
TraceS(this) << "Get audio devices: " << ndevices << endl;
// Scan through devices for various capabilities
RtAudio::DeviceInfo info;
for (unsigned i = 0; i <= ndevices; i++) {
try {
info = audio.getDeviceInfo(i); // may throw RtAudioError
TraceS(this) << "Device:"
<< "\n\tName: " << info.name
<< "\n\tOutput Channels: " << info.outputChannels
<< "\n\tInput Channels: " << info.inputChannels
<< "\n\tDuplex Channels: " << info.duplexChannels
<< "\n\tDefault Output: " << info.isDefaultOutput
<< "\n\tDefault Input: " << info.isDefaultInput
<< "\n\tProbed: " << info.probed
<< endl;
if (info.probed == true && (
(input && info.inputChannels > 0) ||
(!input && info.outputChannels > 0))) {
TraceS(this) << "Adding device: " << info.name << endl;
Device dev((input ? "audioin" : "audioout"), i, info.name, "",
(input ? info.isDefaultInput : info.isDefaultOutput));
devs.push_back(dev);
}
}
catch (RtAudioError& e) {
ErrorS(this) << "Cannot probe audio device: " << e.getMessage() << endl;
}
}
return filterDevices(devs, kFilteredAudioDevicesName);
#endif
}
示例5: TraceS
void Thread::join()
{
TraceS(this) << "Joining" << std::endl;
assert(this->tid() != Thread::currentID());
//assert(this->cancelled()); // probably should be cancelled, but depends on impl
uv_thread_join(&_handle);
assert(!this->running());
assert(!this->started());
TraceS(this) << "Joining: OK" << std::endl;
}
示例6: TraceS
Connection::~Connection()
{
TraceS(this) << "Destroy" << endl;
replaceAdapter(nullptr);
//assert(_closed);
close(); // don't want pure virtual on onClose.
// the shared pointer is being destroyed,
// no need for close() anyway
TraceS(this) << "Destroy: OK" << endl;
}
示例7: TraceS
void Connection::onSocketError(const scy::Error& error)
{
TraceS(this) << "On socket error" << endl;
// Handle the socket error locally
setError(error);
}
示例8: _buffer
UDPSocket::UDPSocket(uv::Loop* loop) :
uv::Handle(loop),
_buffer(65536)
{
TraceS(this) << "Create" << endl;
init();
}
示例9: TraceS
void AsyncPacketQueue::onStreamStateChange(const PacketStreamState& state)
{
TraceS(this) << "Stream state: " << state << endl;
switch (state.id()) {
case PacketStreamState::Active:
break;
case PacketStreamState::Stopped:
break;
case PacketStreamState::Error:
case PacketStreamState::Closed:
// Flush queued items, some protocols can't afford dropped packets
flush();
assert(empty());
cancel();
_thread.join();
break;
//case PacketStreamState::Resetting:
//case PacketStreamState::None:
//case PacketStreamState::Stopping:
}
}
示例10: TCPSocket
SSLSocket::SSLSocket(SSLContext::Ptr context, SSLSession::Ptr session, uv::Loop* loop) :
TCPSocket(loop),
_context(context),
_session(session),
_sslAdapter(this)
{
TraceS(this) << "Create" << endl;
}