HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_NetMessage.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_NetMessage.h ( UT Library, C++)
7  *
8  * COMMENTS:
9  * Very similar to UT_NetStream, but rather than using threads
10  * to interleave packets successfully, it is designed
11  * around using ::select for the same purpose.
12  *
13  * This allows the user to only have to worry about dealing with complete
14  * messages.
15  *
16  * The key tools for end users is the UT_NetMessage and the
17  * UT_NetExchange.
18  */
19 
20 #ifndef __UT_NetMessage__
21 #define __UT_NetMessage__
22 
23 #include "UT_API.h"
24 
25 #include "UT_NetSocket.h"
26 #include "UT_ValArray.h"
27 #include "UT_Interrupt.h"
28 
29 class UT_StopWatch;
30 
31 ///
32 /// UT_NetMessage bears similarity to a UT_NetPacket in that
33 /// it tries to abstract the necessitiy of retrying TCP/IP streams
34 /// until the message is completely received. However, it is built
35 /// around the idea of having a datapump, pumpData, to handle this,
36 /// allowing one to interleave many messages in one thread using
37 /// select()
38 ///
39 /// Write Protocol:
40 /// STATE_WRITE:
41 /// send 32bit length in network byte order
42 /// if length greater than 1<<31, send 32 bit -1
43 /// followed by 64 bit length in network-byte order.
44 /// send myLength from myData
45 /// STATE_WAITACK:
46 /// receive 'j'
47 /// shutdown the connection
48 ///
49 /// Read Protocol:
50 /// STATE_READ:
51 /// receive 32bit length in network byte order
52 /// if length is -1, receive 64bit length in network byte order.
53 /// set myLength and allocate myData
54 /// receive myLength into myData
55 /// STATE_SENDACK:
56 /// send 'j'
57 /// STATE_READFIN:
58 /// receive '' (ie, wait till safe to close)
59 ///
61 {
62 public:
63  UT_NetMessage();
64 
65  /// Frees the allocated data buffer.
66  ~UT_NetMessage();
67 
68  /// What state we are in.
69  /// Thanks to the vagaries of TCP/IP we need an application
70  /// level ACK to verify the data made it across the wire
71  /// before we do our shutdown.
73  {
75 
76  STATE_READ, /// Read message
77  STATE_SENDACK, /// Send ack
78  STATE_READFIN, /// Connection closed after ack sent.
79 
80  STATE_WRITE, /// Send message
81  STATE_WAITACK, /// Wait for connection ack.
82 
83  STATE_READPIPE, /// Blind read of a pipe for our size
84  STATE_READPIPE_BLOSC, /// Blind read blosc pipe.
86  STATE_WRITEPIPE,/// Blind write of a pipe for our size
88  };
89 
90  /// Sends or receives data from the socket until the message
91  /// is complete. When it is complete or errored, returns true. Returns
92  /// false if you should put it back in the select loop.
93  bool pumpData();
94 
95  /// Trys to connect the socket, if already connected a no-op
96  /// Returns false if still not connected, true if connected or error.
97  /// failed is set to true if the connectionf ailed due to a
98  /// UT_CONNECT_FAILED as opposed to being delayed by a UT_WOULD_BLOCK
99  bool tryConnection(bool *failed=0);
100 
101  /// The socket we are attached to.
102  UT_NetSocket *getSocket() const { return mySocket; }
103  /// File descriptor of socket.
104  int getSocketFD() const { return mySocket->getSocket(); }
105 
106  /// Adds our file descriptor to the select set and update
107  /// maxfd.
108  void addToFDSet(fd_set *set, int &maxfd) const;
109 
110  TransmitState state() const { return myState; }
111  bool isErrored() const { return myErrorState; }
112  void flagErrored() { myErrorState = true; }
113 
114  const char *data() const { return myData; }
115  char *data() { return myData; }
116  exint length() const { return myLength; }
117 
118  /// Resizes, useful for pipe messages.
119  void resetLength(TransmitState state, exint newlen);
120 
121  /// Extracts data from the message, applying proper byteswaps.
122  /// Offset is in bytes. Does not need to be aligned.
123  int64 extractInt64(exint offset);
124  int32 extractInt32(exint offset);
125  fpreal32 extractFloat32(exint offset);
126  fpreal64 extractFloat64(exint offset);
127  int16 extractInt16(exint offset);
128  int8 extractInt8(exint offset);
129 
130  /// Inserts data into the message, applying proper byte swaps.
131  /// Offset is in bytes. Does not need to be aligned.
132  void overwriteInt64(exint offset, int64 val);
133  void overwriteInt32(exint offset, int32 val);
134  void overwriteFloat32(exint offset, fpreal32 val);
135  void overwriteFloat64(exint offset, fpreal64 val);
136  void overwriteInt16(exint offset, int16 val);
137  void overwriteInt8(exint offset, int8 val);
138 
139  /// Determine source/sink of this message.
140  /// Because we shutdown the socket on completion of the
141  /// protocol, we always gain ownership of the socket and
142  /// will handle deleting it ourselves.
143  void setReadSocket(UT_NetSocket *socket);
144  void setWriteSocket(UT_NetSocket *socket);
145  void setWriteSocket(const char *addr, int port);
146 
147  /// The headersize, in bytes, is prepended as nulls to the message.
148  /// The headersize *is* included in the myLength, the receiver
149  /// doesn't know about the distinction between header and data!
150  void setWriteData(const char *data, exint len)
151  { setWriteDataWithHeader(0, data, len); }
152  void setWriteData(const char *data)
153  { setWriteData(data, strlen(data)); }
154  void setWriteDataWithHeader(exint headersize, const char *data, exint len);
155  void setWriteDataWithHeader(exint headersize, const char *data)
156  { setWriteDataWithHeader(headersize, data, strlen(data)); }
157 
158  /// Allocates a blank write buffer of the given size.
159  /// It is assumed the caller will fill it out by writing to data()
161  { setWriteDataWithHeader(bufsize, 0, 0); }
162 
163  static int64 totalBytesSent();
164  static int64 totalBytesReceived();
165  static void clearByteCounters();
166 
167  /// Tracks total network time. This does not include time
168  /// spent in background threads, only the time spent to sync
169  /// up to such threads. This includes transfer time and sync
170  /// time. (It is hard to determine what time spent waiting on
171  /// a pipe is the other system still computing, and what is just
172  /// waiting on the network to transfer data...)
173  /// There is no way to clear this because some load balancing
174  /// systems may want it to properly accumulate between frames
175  static fpreal64 totalNetworkTime();
176 
177  /// Adds the given number of seconds to total network timecounter.
178  static void addToTotalNetworkTime(fpreal64 netnewtime);
179 
180  void setState(TransmitState state) { myState = state; }
181 
182  /// Compresses our data into swap buffer, then swap the pointers
183  /// so we will send the compressed buffer. The header measures the
184  /// number of bytes that will be copied over directly.
185  bool compress(exint header);
186 
187  /// Decompress our block and swap so we point at the decompressed
188  /// buffer. If it fails, it was a corrupt buffer of some sort.
189  /// The header is copied directly.
190  bool decompress(exint header);
191 
192 private:
193 
194  /// Tracking variables.
195  static int64 ourTotalBytesSent;
196  static int64 ourTotalBytesReceived;
197  static fpreal64 ourTotalNetworkTime;
198 
199  UT_NetSocket *mySocket;
200  exint myCapacity;
201  exint myLength;
202  char *myData;
203 
204  // When we compress/decompress we swap buffers with this
205  // buffer. We can thus avoid re-creating every frame in cases where
206  // we cache our messages.
207  char *mySwapData;
208  exint mySwapLength;
209  exint mySwapCapacity;
210 
211  TransmitState myState;
212  bool myErrorState;
213 
214  // Internal state of where we are in terms of pumping...
215  // -4 to -1 are for sending the length.
216  exint myDataPos;
217 
218  // Flag if we are pumping the second length.
219  bool myProcessing64BitLength;
220 
221  int32 myNetLength; // htonl version of length, -1 if 64bit
222  int64 myNetLength64; // htonl version of length64
223 };
224 
225 
226 ///
227 /// UT_NetMessagePump
228 ///
229 /// Interleaves processing from possibly many different message
230 /// sources.
231 ///
232 /// postMessage() can be used to queue messages to send after
233 /// their setWriteSocket and setWriteData has been invoked.
234 ///
235 /// listenSocket() will invoke accept() and add to the completed()
236 /// list messages as they are done.
237 ///
238 ///
240 {
241 public:
243  /// On destruction all messages on our internal lists will be destroyed.
244  virtual ~UT_NetMessagePump();
245 
246  /// Adds the message to our queue to process.
247  /// We take ownership of the UT_NetMessage until it is removed
248  /// from one of our lists.
249  void postMessage(UT_NetMessage *msg);
250 
251  /// Resets, but does *not* free any messages it has.
252  void reset()
253  {
254  myWorkList.clear();
255  myErrorList.clear();
256  myCompleteList.clear();
257  }
258 
259  /// List of all completed incoming messages.
260  ///
261  /// To process a message from the completed list,
262  /// UT_NetMessage *msg = pump.completed()(i);
263  /// pump.completed()(i) = 0;
264  /// ... use msg ...
265  /// delete msg;
266  UT_ValArray<UT_NetMessage *> &completed() { return myCompleteList; }
267 
268  /// List of messages that have entered the error status.
269  /// This includes failed outgoing messages as well as incomplete
270  /// incoming messages.
271  UT_ValArray<UT_NetMessage *> &errored() { return myErrorList; }
272 
273  /// Starts listening to the given socket for messages
274  /// We do not own this socket, caller should delete it (but not
275  /// before stopping listening or deleting the pump!)
276  /// Connections accepted from this socket will be read
277  /// via UT_NetMessage's protocol.
278  void listenSocket(UT_NetSocket *socket);
279  /// Stops listening from a given socket.
280  void stopListening(UT_NetSocket *socket);
281 
282  /// Processes active messages and listens for incoming messages.
283  /// Returns true if there is the *potential* of more work - if
284  /// listening to a socket this is always true!
285  bool pumpData(int timeoutms);
286 
287  /// The number of messages still pending.
288  int pendingMessages() const { return myWorkList.entries(); }
289 
290  void deleteSentMessages(bool shoulddelete) { myDeleteSent = shoulddelete; }
291  void receiveAnnounce(bool receiveannounce) { myReceiveAnnounce = receiveannounce; }
292 protected:
299 };
300 
302 {
303 public:
305  virtual ~ut_NetPeerData() {}
307  {
308  *this = src;
309  }
310 
312  {
314  myPort = src.myPort;
315  myPeer = src.myPeer;
316  return *this;
317  }
318 
320  int myPort;
321  int myPeer;
322 };
323 
324 ///
325 /// UT_NetExchange
326 ///
327 /// Uses a tracker to exchange data between peers.
328 /// The tracker handles peer discovery and synchronization. A unique
329 /// jobname is used to allow multiple net exchanges to use the same
330 /// tracker.
331 ///
332 /// EXTERNAL PROTOCOL:
333 ///
334 /// UT_NetMessages accepted or returned from this have an 8 byte
335 /// header. The fields are filled out for you on a sendData()
336 /// and can be queried to determine the message source when
337 /// pulling completed messages from the result list.
338 ///
339 /// The first byte is the message type. If it is 'p', it is
340 /// peer data. Users of UT_NetExchange should only see these
341 /// messages as the other are internal tracker messages.
342 /// 'P' is used for blosc compressed peer data, it will be uncompressed
343 /// and revealed to the user as a 'p' data.
344 ///
345 /// extractInt16(4): Destination peer #
346 /// extractInt16(6): Source peer #
347 ///
348 /// Anything 8 and after is user data.
349 ///
350 /// INTERNAL PROTOCOL:
351 ///
352 /// From the tracker:
353 ///
354 /// Message of type 'b' is a barrier value. The 32 bit network
355 /// byte order barrier value starts at offset 1.
356 ///
357 /// Message type of 'c' is a peer list. A space delimited list
358 /// of address port peer triples is present, one for each peer.
359 ///
360 /// Message type of 'd' is a done flag. It informs that all
361 /// the peers have reported done to the tracker.
362 ///
363 /// Message type of 'e' is an error. One of the peers reported
364 /// an error to the tracker that got broadcast back.
365 ///
366 /// To the tracker:
367 ///
368 /// Messages to the tracker all have the format
369 /// command port peer npeer jobname
370 ///
371 /// port is the listen port used by this peer.
372 /// peer is the peer number
373 /// npeer is the number of peers
374 /// jobname is the name of the current job
375 ///
376 /// command is one of:
377 /// acquire: A peer is logging on to this jobname.
378 /// done: A peer has all the data it cares about from the netexchange.
379 /// error: A peer has encountered a fatal network error and wants a clean
380 /// shutdown.
381 /// barrierset: Establish a barrier, the current value is peer.
382 /// barrierwait: Will recevie a done message when the peer value is reached or
383 /// exceeded by the named barrier.
384 ///
386 {
387 public:
388  UT_NetExchange(const UT_StringHolder &trackeraddr, int trackerport,
389  int peer, int npeer, const UT_StringHolder &jobname);
390  virtual ~UT_NetExchange();
391 
393  {
394  public:
395  AutoNetworkTimer(UT_NetExchange *xchg) { myXchg = xchg; myXchg->startNetworkTimer(); }
396  ~AutoNetworkTimer() { myXchg->stopNetworkTimer(); }
398  };
399 
400 
401  /// Posts the data to be sent to the specific destination
402  /// machine.
403  /// The data will be copied into an internal buffer.
404  /// Note that destpeer could be this, in which case we'll just
405  /// have effected a very slow copy.
406  void sendData(int destpeer, const char *data, exint len);
407 
408  /// Gains ownership of the message. The message must have
409  /// an 8 byte header reserved for the net exchange protocol.
410  /// The rest of the data in the net message is unaffected.
411  void sendData(int destpeer, UT_NetMessage *msg);
412 
413  /// Flags this peer as done. You should still process the pump until
414  /// interrupted or completed, however, as the other peers
415  /// may not yet be done. Likewise, you may still continue
416  /// to get new requests from other peers.
417  void sendDone();
418 
419  /// Returns true until the tracker notifies us that all of the
420  /// peers have invoked sendDone() or an error occurs.
421  bool pumpData(int timeoutms);
422 
423  /// Pumps the message pump until we have received the expected
424  /// number of messages and the tracker reports us as done. The
425  /// messages in the completed array must be deleted by the caller.
426  /// UT_Interrupt is used to interrupt this.
427  /// true if everything finished properly, false if there was
428  /// an interrupt or error.
429  bool receiveDataLoop(UT_Array<UT_NetMessage *> &completed,
430  int expectedmessages, int timeoutms = 100);
431 
432 
433  /// Uses a background thread to run the message loop. You should
434  /// not inspect/alter UT_NetExchange or its owned UT_NetMessages
435  /// until finished.
436  bool asyncReceiveDataLoop(UT_Array<UT_NetMessage *> &completed,
437  int expectedmessages, int timeoutms = 100);
438  /// Blocks until the asyncReceiveDataLoop completes/errors.
439  bool finishAsyncReceiveDataLoop();
440 
441  /// Pumps the message pump until we have received the expected
442  /// number of data messages and the tracker reports us as done. The
443  /// messages in the completed array must be deleted by the caller.
444  /// UT_Interrupt is used to interrupt this.
445  /// true if everything finished properly, false if there was
446  /// an interrupt or error.
447  ///
448  /// The callback processes any message with a 'r' as the 8th byte.
449  /// Final messages (which do not get further processed) should have
450  /// 'd' as the 8th byte - they will
451  /// be added to the completed list and count to the expectedmessages.
452  /// It should be a function object taking two parameters,
453  /// UT_NetExchange * and UT_NetMessage *.
454  ///
455  /// UT_Interrupt is used to interrupt this.
456  /// true if everything finished properly, false if there was
457  /// an interrupt or error.
458  template <class CallbackType>
460  int expectedmessages,
461  CallbackType callback,
462  int timeoutms = 100)
463  {
464  // Because we append to complist, allow for the case where
465  // we are accumulating...
466  int goal = complist.entries() + expectedmessages;
467  bool done = false;
468  UT_Interrupt *boss = UTgetInterrupt();
469  AutoNetworkTimer timer(this);
470 
471  while (1)
472  {
473  if (boss->opInterrupt())
474  return false;
475 
476  if (!pumpData(timeoutms))
477  break;
478 
479  for (exint i = 0; i < completed().entries(); i++)
480  {
481  UT_NetMessage *msg = completed()(i);
482  completed()(i) = 0;
483 
484  if (msg->extractInt8(8) == 'r')
485  {
486  callback(this, msg);
487  delete msg;
488  }
489  else
490  complist.append(msg);
491  }
492 
493  // See if we got our done package.
494  if (!done && gotPeerList() && (complist.entries() >= goal))
495  {
496  sendDone();
497  done = true;
498  }
499  }
500 
501  return !isErrored();
502  }
503 
504  /// The net exchange goes into an error state when the connection
505  /// the tracker sends an error message.
506  /// peer-to-peer errors are dealt with by sending the tracker
507  /// an error message which is supposed to broadcast the error
508  /// back to all the peers. Error recovery can thus be effected
509  /// provided it is the tracker that stays up.
510  bool isErrored() const { return myErrorFromTracker; }
511 
512  /// Same semantics as UT_NetMessagePump. Stores all the messages
513  /// that have successfully arrived.
514  /// This first 8 bytes of theses messages is the header with
515  /// which you can extract the source peer of the message.
516  UT_ValArray<UT_NetMessage *> &completed() { return myCompleted; }
517 
518  /// Returns if we have received a peer list from the tracker.
519  bool gotPeerList() const { return myGotPeerList; }
520 
521  void setCompressionThreshold(exint threshold_bytes) { myCompressionThreshold = threshold_bytes; }
522  exint compressionThreshold() const { return myCompressionThreshold; }
523 
524  ut_NetPeerData *findPeer(int peer);
525 protected:
526  void processTrackerMessage(UT_NetMessage *msg);
527  /// Assembles a message to the tracker.
528  void sendTrackerMessage(const char *msg);
529 
530  void startNetworkTimer();
531  void stopNetworkTimer();
532 
534  int myNPeer, myPeer;
536 
539 
541  bool myError;
544 
547 
549 
550  /// We track our elapsed time for printing status
552  int myTimerDelay, myHeartbeat;
554 
555  /// Number of bytes to start compressing at.
557 
558  friend class AutoNetworkTimer;
559 };
560 
562 {
563 public:
564  UT_NetMessagePipe(const UT_StringHolder &trackeraddr, int trackerport,
565  int peer, int npeer, const UT_StringHolder &jobname);
566  virtual ~UT_NetMessagePipe();
567 
569  {
570  public:
571  AutoNetworkTimer(UT_NetMessagePipe *pipe) { myPipe = pipe; myPipe->startNetworkTimer(); }
572  ~AutoNetworkTimer() { myPipe->stopNetworkTimer(); }
574  };
575 
576 
577  /// Prepares the pipes, returns true if successful.
578  bool openPipes(int timeoutms = 100);
579 
580  /// Shuts down the pipes, returns true if successful.
581  bool closePipes(int timeoutms = 100);
582 
583  /// Run resetLength on the read pipes to setup the desired amount
584  /// to read.
585  /// Likewise, resetLength the write pipes & fill in the data to write.
586  UT_NetMessage *readPipe(int peer) { return myReadPipes(peer); }
587  UT_NetMessage *writePipe(int peer) { return myWritePipes(peer); }
588 
589  /// Flushes all write pipes, fills all read pipes.
590  /// Afterwards the readPipes will have their data filled in.
591  /// Returns true if not errored or aborted.
592  bool transferData(int timeoutms = 100);
593 
594  void setCompressionThreshold(exint threshold_bytes) { myCompressionThreshold = threshold_bytes; }
595  exint compressionThreshold() const { return myCompressionThreshold; }
596 
597 protected:
598  /// Returns true until all the messages have been flushed.
599  bool pumpData(int timeoutms);
600 
601  void startNetworkTimer();
602  void stopNetworkTimer();
603 
607  int myNPeer, myPeer;
613 
614  /// Number of bytes to start compressing at.
616 
617  friend class AutoNetworkTimer;
618 };
619 
620 ///
621 /// UT_NetBarrier
622 ///
623 /// Very similar to UT_NetExchange, using the same tracker. However,
624 /// it is meant for creating producer/consumer queues where the data
625 /// is transmitted OOB (ie, on shared disk resource) The producer
626 /// can call setValue() to indicate how far it has completed. The consumer
627 /// can invoke waitValue() to idle until the setValue is equal or
628 /// greater than the waitValue.
629 ///
630 /// These calls will all block until success, error, or interrupt.
631 ///
633 {
634 public:
635  UT_NetBarrier(const UT_StringHolder &trackeraddr, int trackerport,
636  const UT_StringHolder &jobname);
637  virtual ~UT_NetBarrier();
638 
639  /// Tells the tracker to update the barrier value to the given
640  /// value. Does not listen for a tracker response.
641  void setValue(int val);
642 
643  /// Requests the tracker to alert us when the given value is
644  /// reached on the barrier.
645  void waitValue(int val);
646 
647  /// Returns current value of the barrier and then increments
648  /// the barrier's value.
649  /// Blocks until the tracker responds.
650  int incrementValue(int defaultval);
651 
652 protected:
653  /// Creates and posts a message for the tracker.
654  void sendTrackerMessage(const char *msg, int value);
655 
656  /// A simplified method for running the message pump until
657  /// the system errors or is interrupted.
658  void blockUntilComplete();
659 
660  /// Returns true until the barrier has been resolved or error
661  /// occurs
662  bool pumpData(int timeoutms);
663 
666  bool myError;
667 
669 
673 };
674 
675 
676 #endif
677 
void reset()
Resets, but does not free any messages it has.
UT_NetSocket * myToSelf
GLenum GLuint GLsizei bufsize
Definition: glcorearb.h:1817
UT_NetSocket * getSocket() const
The socket we are attached to.
UT_ValArray< UT_NetMessage * > myWorkList
void setWriteData(const char *data, exint len)
void setWriteData(const char *data)
bool isErrored() const
exint compressionThreshold() const
void setCompressionThreshold(exint threshold_bytes)
UT_StringHolder myJobName
void flagErrored()
void setWriteDataLength(exint bufsize)
UT_ValArray< UT_NetMessage * > myErrorList
UT_ValArray< UT_NetMessage * > myCompleteList
#define UT_API
Definition: UT_API.h:12
Blind read blosc pipe.
Definition: UT_NetMessage.h:85
UT_ValArray< UT_NetMessage * > myAnnounce
png_uint_32 i
Definition: png.h:2877
UT_ValArray< UT_NetMessage * > myWritePipes
UT_NetMessage * readPipe(int peer)
UT_ValArray< UT_NetMessage * > myCompleted
fpreal64 myLastTimerVal
const ut_NetPeerData & operator=(const ut_NetPeerData &src)
ut_NetPeerData(const ut_NetPeerData &src)
UT_ValArray< UT_NetMessage * > & completed()
signed char int8
Definition: SYS_Types.h:24
UT_ValArray< UT_NetMessage * > myWaitingForPeers
int8 extractInt8(exint offset)
long long int64
Definition: SYS_Types.h:100
exint myCompressionThreshold
Number of bytes to start compressing at.
int opInterrupt(int percent=-1)
UT_ValArray< UT_NetMessage * > & completed()
Blind write of a pipe for our size.
Definition: UT_NetMessage.h:87
AutoNetworkTimer(UT_NetMessagePipe *pipe)
void deleteSentMessages(bool shoulddelete)
UT_ValArray< UT_NetMessage * > myReadPipes
void setCompressionThreshold(exint threshold_bytes)
const char * data() const
int64 exint
Definition: SYS_Types.h:109
bool processDataLoop(UT_Array< UT_NetMessage * > &complist, int expectedmessages, CallbackType callback, int timeoutms=100)
void setState(TransmitState state)
double fpreal64
Definition: SYS_Types.h:185
UT_NetMessagePump myPump
GLintptr offset
Definition: glcorearb.h:664
UT_Array< ut_NetPeerData > myPeerList
UT_NetMessagePump myPump
void harden()
Take shallow copy and make it deep.
Definition: UT_String.h:213
UT_String myAddress
virtual ~ut_NetPeerData()
GLboolean * data
Definition: glcorearb.h:130
Connection closed after ack sent.
Definition: UT_NetMessage.h:80
UT_NetSocket * myToSelf
int getSocketFD() const
File descriptor of socket.
int int32
Definition: SYS_Types.h:28
UT_ValArray< UT_NetMessage * > & errored()
void startNetworkTimer()
exint compressionThreshold() const
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:446
bool isErrored() const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
exint length() const
bool gotPeerList() const
Returns if we have received a peer list from the tracker.
UT_NetMessage * writePipe(int peer)
void receiveAnnounce(bool receiveannounce)
UT_API UT_Interrupt * UTgetInterrupt()
Obtain global UT_Interrupt singleton.
TransmitState state() const
GLuint GLfloat * val
Definition: glcorearb.h:1607
Blind read of a pipe for our size.
Definition: UT_NetMessage.h:84
exint append(void)
Definition: UT_Array.h:95
void startNetworkTimer()
UT_StringHolder myJobName
UT_NetSocket * myToSelf
UT_ValArray< UT_NetSocket * > myServerList
Wait for connection ack.
Definition: UT_NetMessage.h:83
UT_StringHolder myJobName
UT_StringHolder myTrackerAddr
UT_StringHolder myTrackerAddress
exint myCompressionThreshold
Number of bytes to start compressing at.
short int16
Definition: SYS_Types.h:26
void setWriteDataWithHeader(exint headersize, const char *data)
float fpreal32
Definition: SYS_Types.h:184
AutoNetworkTimer(UT_NetExchange *xchg)
UT_NetMessagePump myPump
int pendingMessages() const
The number of messages still pending.
UT_StopWatch * myTimer
We track our elapsed time for printing status.
GLenum src
Definition: glcorearb.h:1792
UT_StringHolder myTrackerAddr