30 _dg_received(_dg_lock),
31 _dg_processed(_dg_lock)
39~DatagramGeneratorNet() {
50 if (!thing_available()) {
51 if (net_cat.is_spam()) {
53 <<
"DatagramGeneratorNet polling\n";
57 while (!thing_available()) {
59 if (net_cat.is_spam()) {
61 <<
"DatagramGeneratorNet returning EOF\n";
68 bool got_dg = get_thing(data);
69 nassertr(got_dg,
false);
74 while (!thing_available()) {
76 if (net_cat.is_spam()) {
78 <<
"DatagramGeneratorNet returning EOF\n";
82 if (net_cat.is_spam()) {
84 <<
"DatagramGeneratorNet waiting\n";
88 bool got_dg = get_thing(data);
89 nassertr(got_dg,
false);
90 _dg_processed.notify();
93 if (net_cat.is_spam()) {
95 <<
"DatagramGeneratorNet returning datagram of length "
96 << data.get_length() <<
"\n";
110 return _sockets.empty();
120 Sockets::const_iterator si;
121 for (si = _sockets.begin(); si != _sockets.end(); ++si) {
122 SocketInfo *sinfo = (*si);
135void DatagramGeneratorNet::
138 while (!enqueue_thing(datagram)) {
139 _dg_processed.
wait();
141 _dg_received.notify();
void wait()
Waits on the condition.
void poll()
Explicitly polls the available sockets to see if any of them have any noise.
bool is_polling() const
Returns true if the reader is a polling reader, i.e.
ConnectionReader(ConnectionManager *manager, int num_threads, const std::string &thread_name=std::string())
Creates a new ConnectionReader with the indicated number of threads to handle requests.
virtual bool is_error()
Returns true if the stream has an error condition.
DatagramGeneratorNet(ConnectionManager *manager, int num_threads)
Creates a new DatagramGeneratorNet with the indicated number of threads to handle requests.
virtual bool get_datagram(Datagram &data)
Reads the next datagram from the stream.
virtual bool is_eof()
Returns true if the stream has been closed normally.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Similar to MutexHolder, but for a light mutex.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
A specific kind of Datagram, especially for sending across or receiving from a network.
This is the implementation of a family of things that queue up their return values for later retrieva...
static void force_yield()
Suspends the current thread for the rest of the current epoch.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.