HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  /// Grows a write buffer to this size, must be done before transmitting.
164  /// Existing data is left intact.
165  void growWriteData(exint newlen);
166 
167  static int64 totalBytesSent();
168  static int64 totalBytesReceived();
169  static void clearByteCounters();
170 
171  /// Tracks total network time. This does not include time
172  /// spent in background threads, only the time spent to sync
173  /// up to such threads. This includes transfer time and sync
174  /// time. (It is hard to determine what time spent waiting on
175  /// a pipe is the other system still computing, and what is just
176  /// waiting on the network to transfer data...)
177  /// There is no way to clear this because some load balancing
178  /// systems may want it to properly accumulate between frames
179  static fpreal64 totalNetworkTime();
180 
181  /// Adds the given number of seconds to total network timecounter.
182  static void addToTotalNetworkTime(fpreal64 netnewtime);
183 
184  void setState(TransmitState state) { myState = state; }
185 
186  /// Compresses our data into swap buffer, then swap the pointers
187  /// so we will send the compressed buffer. The header measures the
188  /// number of bytes that will be copied over directly.
189  bool compress(exint header);
190 
191  /// Decompress our block and swap so we point at the decompressed
192  /// buffer. If it fails, it was a corrupt buffer of some sort.
193  /// The header is copied directly.
194  bool decompress(exint header);
195 
196 private:
197 
198  /// Tracking variables.
199  static int64 ourTotalBytesSent;
200  static int64 ourTotalBytesReceived;
201  static fpreal64 ourTotalNetworkTime;
202 
203  UT_NetSocket *mySocket;
204  exint myCapacity;
205  exint myLength;
206  char *myData;
207 
208  // When we compress/decompress we swap buffers with this
209  // buffer. We can thus avoid re-creating every frame in cases where
210  // we cache our messages.
211  char *mySwapData;
212  exint mySwapLength;
213  exint mySwapCapacity;
214 
215  TransmitState myState;
216  bool myErrorState;
217 
218  // Internal state of where we are in terms of pumping...
219  // -4 to -1 are for sending the length.
220  exint myDataPos;
221 
222  // Flag if we are pumping the second length.
223  bool myProcessing64BitLength;
224 
225  int32 myNetLength; // htonl version of length, -1 if 64bit
226  int64 myNetLength64; // htonl version of length64
227 };
228 
229 
230 ///
231 /// UT_NetMessagePump
232 ///
233 /// Interleaves processing from possibly many different message
234 /// sources.
235 ///
236 /// postMessage() can be used to queue messages to send after
237 /// their setWriteSocket and setWriteData has been invoked.
238 ///
239 /// listenSocket() will invoke accept() and add to the completed()
240 /// list messages as they are done.
241 ///
242 ///
244 {
245 public:
247  /// On destruction all messages on our internal lists will be destroyed.
248  virtual ~UT_NetMessagePump();
249 
250  /// Adds the message to our queue to process.
251  /// We take ownership of the UT_NetMessage until it is removed
252  /// from one of our lists.
253  void postMessage(UT_NetMessage *msg);
254 
255  /// Resets, but does *not* free any messages it has.
256  void reset()
257  {
258  myWorkList.clear();
259  myErrorList.clear();
260  myCompleteList.clear();
261  }
262 
263  /// List of all completed incoming messages.
264  ///
265  /// To process a message from the completed list,
266  /// UT_NetMessage *msg = pump.completed()(i);
267  /// pump.completed()(i) = 0;
268  /// ... use msg ...
269  /// delete msg;
270  UT_ValArray<UT_NetMessage *> &completed() { return myCompleteList; }
271 
272  /// List of messages that have entered the error status.
273  /// This includes failed outgoing messages as well as incomplete
274  /// incoming messages.
275  UT_ValArray<UT_NetMessage *> &errored() { return myErrorList; }
276 
277  /// Starts listening to the given socket for messages
278  /// We do not own this socket, caller should delete it (but not
279  /// before stopping listening or deleting the pump!)
280  /// Connections accepted from this socket will be read
281  /// via UT_NetMessage's protocol.
282  void listenSocket(UT_NetSocket *socket);
283  /// Stops listening from a given socket.
284  void stopListening(UT_NetSocket *socket);
285 
286  /// Processes active messages and listens for incoming messages.
287  /// Returns true if there is the *potential* of more work - if
288  /// listening to a socket this is always true!
289  bool pumpData(int timeoutms);
290 
291  /// The number of messages still pending.
292  int pendingMessages() const { return myWorkList.entries(); }
293 
294  void deleteSentMessages(bool shoulddelete) { myDeleteSent = shoulddelete; }
295  void receiveAnnounce(bool receiveannounce) { myReceiveAnnounce = receiveannounce; }
296 protected:
303 };
304 
306 {
307 public:
309  virtual ~ut_NetPeerData() {}
311  {
312  *this = src;
313  }
314 
316  {
318  myPort = src.myPort;
319  myPeer = src.myPeer;
320  return *this;
321  }
322 
324  int myPort;
325  int myPeer;
326 };
327 
328 ///
329 /// UT_NetExchange
330 ///
331 /// Uses a tracker to exchange data between peers.
332 /// The tracker handles peer discovery and synchronization. A unique
333 /// jobname is used to allow multiple net exchanges to use the same
334 /// tracker.
335 ///
336 /// EXTERNAL PROTOCOL:
337 ///
338 /// UT_NetMessages accepted or returned from this have an 8 byte
339 /// header. The fields are filled out for you on a sendData()
340 /// and can be queried to determine the message source when
341 /// pulling completed messages from the result list.
342 ///
343 /// The first byte is the message type. If it is 'p', it is
344 /// peer data. Users of UT_NetExchange should only see these
345 /// messages as the other are internal tracker messages.
346 /// 'P' is used for blosc compressed peer data, it will be uncompressed
347 /// and revealed to the user as a 'p' data.
348 ///
349 /// extractInt16(4): Destination peer #
350 /// extractInt16(6): Source peer #
351 ///
352 /// Anything 8 and after is user data.
353 ///
354 /// INTERNAL PROTOCOL:
355 ///
356 /// From the tracker:
357 ///
358 /// Message of type 'b' is a barrier value. The 32 bit network
359 /// byte order barrier value starts at offset 1.
360 ///
361 /// Message type of 'c' is a peer list. A space delimited list
362 /// of address port peer triples is present, one for each peer.
363 ///
364 /// Message type of 'd' is a done flag. It informs that all
365 /// the peers have reported done to the tracker.
366 ///
367 /// Message type of 'e' is an error. One of the peers reported
368 /// an error to the tracker that got broadcast back.
369 ///
370 /// To the tracker:
371 ///
372 /// Messages to the tracker all have the format
373 /// command port peer npeer jobname
374 ///
375 /// port is the listen port used by this peer.
376 /// peer is the peer number
377 /// npeer is the number of peers
378 /// jobname is the name of the current job
379 ///
380 /// command is one of:
381 /// acquire: A peer is logging on to this jobname.
382 /// done: A peer has all the data it cares about from the netexchange.
383 /// error: A peer has encountered a fatal network error and wants a clean
384 /// shutdown.
385 /// barrierset: Establish a barrier, the current value is peer.
386 /// barrierwait: Will recevie a done message when the peer value is reached or
387 /// exceeded by the named barrier.
388 ///
390 {
391 public:
392  UT_NetExchange(const UT_StringHolder &trackeraddr, int trackerport,
393  int peer, int npeer, const UT_StringHolder &jobname);
394  virtual ~UT_NetExchange();
395 
397  {
398  public:
399  AutoNetworkTimer(UT_NetExchange *xchg) { myXchg = xchg; myXchg->startNetworkTimer(); }
400  ~AutoNetworkTimer() { myXchg->stopNetworkTimer(); }
402  };
403 
404 
405  /// Posts the data to be sent to the specific destination
406  /// machine.
407  /// The data will be copied into an internal buffer.
408  /// Note that destpeer could be this, in which case we'll just
409  /// have effected a very slow copy.
410  void sendData(int destpeer, const char *data, exint len);
411 
412  /// Gains ownership of the message. The message must have
413  /// an 8 byte header reserved for the net exchange protocol.
414  /// The rest of the data in the net message is unaffected.
415  void sendData(int destpeer, UT_NetMessage *msg);
416 
417  /// Flags this peer as done. You should still process the pump until
418  /// interrupted or completed, however, as the other peers
419  /// may not yet be done. Likewise, you may still continue
420  /// to get new requests from other peers.
421  void sendDone();
422 
423  /// Returns true until the tracker notifies us that all of the
424  /// peers have invoked sendDone() or an error occurs.
425  bool pumpData(int timeoutms);
426 
427  /// Pumps the message pump until we have received the expected
428  /// number of messages and the tracker reports us as done. The
429  /// messages in the completed array must be deleted by the caller.
430  /// UT_Interrupt is used to interrupt this.
431  /// true if everything finished properly, false if there was
432  /// an interrupt or error.
433  bool receiveDataLoop(UT_Array<UT_NetMessage *> &completed,
434  int expectedmessages, int timeoutms = 100);
435 
436 
437  /// Uses a background thread to run the message loop. You should
438  /// not inspect/alter UT_NetExchange or its owned UT_NetMessages
439  /// until finished.
440  bool asyncReceiveDataLoop(UT_Array<UT_NetMessage *> &completed,
441  int expectedmessages, int timeoutms = 100);
442  /// Blocks until the asyncReceiveDataLoop completes/errors.
443  bool finishAsyncReceiveDataLoop();
444 
445  /// Pumps the message pump until we have received the expected
446  /// number of data messages and the tracker reports us as done. The
447  /// messages in the completed array must be deleted by the caller.
448  /// UT_Interrupt is used to interrupt this.
449  /// true if everything finished properly, false if there was
450  /// an interrupt or error.
451  ///
452  /// The callback processes any message with a 'r' as the 8th byte.
453  /// Final messages (which do not get further processed) should have
454  /// 'd' as the 8th byte - they will
455  /// be added to the completed list and count to the expectedmessages.
456  /// It should be a function object taking two parameters,
457  /// UT_NetExchange * and UT_NetMessage *.
458  ///
459  /// UT_Interrupt is used to interrupt this.
460  /// true if everything finished properly, false if there was
461  /// an interrupt or error.
462  template <class CallbackType>
464  int expectedmessages,
465  CallbackType callback,
466  int timeoutms = 100)
467  {
468  // Because we append to complist, allow for the case where
469  // we are accumulating...
470  int goal = complist.entries() + expectedmessages;
471  bool done = false;
472  UT_Interrupt *boss = UTgetInterrupt();
473  AutoNetworkTimer timer(this);
474 
475  while (1)
476  {
477  if (boss->opInterrupt())
478  return false;
479 
480  if (!pumpData(timeoutms))
481  break;
482 
483  for (exint i = 0; i < completed().entries(); i++)
484  {
485  UT_NetMessage *msg = completed()(i);
486  completed()(i) = 0;
487 
488  if (msg->extractInt8(8) == 'r')
489  {
490  callback(this, msg);
491  delete msg;
492  }
493  else
494  complist.append(msg);
495  }
496 
497  // See if we got our done package.
498  if (!done && gotPeerList() && (complist.entries() >= goal))
499  {
500  sendDone();
501  done = true;
502  }
503  }
504 
505  return !isErrored();
506  }
507 
508  /// The net exchange goes into an error state when the connection
509  /// the tracker sends an error message.
510  /// peer-to-peer errors are dealt with by sending the tracker
511  /// an error message which is supposed to broadcast the error
512  /// back to all the peers. Error recovery can thus be effected
513  /// provided it is the tracker that stays up.
514  bool isErrored() const { return myErrorFromTracker; }
515 
516  /// Same semantics as UT_NetMessagePump. Stores all the messages
517  /// that have successfully arrived.
518  /// This first 8 bytes of theses messages is the header with
519  /// which you can extract the source peer of the message.
520  UT_ValArray<UT_NetMessage *> &completed() { return myCompleted; }
521 
522  /// Returns if we have received a peer list from the tracker.
523  bool gotPeerList() const { return myGotPeerList; }
524 
525  void setCompressionThreshold(exint threshold_bytes) { myCompressionThreshold = threshold_bytes; }
526  exint compressionThreshold() const { return myCompressionThreshold; }
527 
528  ut_NetPeerData *findPeer(int peer);
529 protected:
530  void processTrackerMessage(UT_NetMessage *msg);
531  /// Assembles a message to the tracker.
532  void sendTrackerMessage(const char *msg);
533 
534  void startNetworkTimer();
535  void stopNetworkTimer();
536 
538  int myNPeer, myPeer;
540 
543 
545  bool myError;
548 
551 
553 
554  /// We track our elapsed time for printing status
556  int myTimerDelay, myHeartbeat;
558 
559  /// Number of bytes to start compressing at.
561 
562  friend class AutoNetworkTimer;
563 };
564 
566 {
567 public:
568  UT_NetMessagePipe(const UT_StringHolder &trackeraddr, int trackerport,
569  int peer, int npeer, const UT_StringHolder &jobname);
570  virtual ~UT_NetMessagePipe();
571 
573  {
574  public:
575  AutoNetworkTimer(UT_NetMessagePipe *pipe) { myPipe = pipe; myPipe->startNetworkTimer(); }
576  ~AutoNetworkTimer() { myPipe->stopNetworkTimer(); }
578  };
579 
580 
581  /// Prepares the pipes, returns true if successful.
582  bool openPipes(int timeoutms = 100);
583 
584  /// Shuts down the pipes, returns true if successful.
585  bool closePipes(int timeoutms = 100);
586 
587  /// Run resetLength on the read pipes to setup the desired amount
588  /// to read.
589  /// Likewise, resetLength the write pipes & fill in the data to write.
590  UT_NetMessage *readPipe(int peer) { return myReadPipes(peer); }
591  UT_NetMessage *writePipe(int peer) { return myWritePipes(peer); }
592 
593  /// Flushes all write pipes, fills all read pipes.
594  /// Afterwards the readPipes will have their data filled in.
595  /// Returns true if not errored or aborted.
596  bool transferData(int timeoutms = 100);
597 
598  void setCompressionThreshold(exint threshold_bytes) { myCompressionThreshold = threshold_bytes; }
599  exint compressionThreshold() const { return myCompressionThreshold; }
600 
601 protected:
602  /// Returns true until all the messages have been flushed.
603  bool pumpData(int timeoutms);
604 
605  void startNetworkTimer();
606  void stopNetworkTimer();
607 
611  int myNPeer, myPeer;
617 
618  /// Number of bytes to start compressing at.
620 
621  friend class AutoNetworkTimer;
622 };
623 
624 ///
625 /// UT_NetBarrier
626 ///
627 /// Very similar to UT_NetExchange, using the same tracker. However,
628 /// it is meant for creating producer/consumer queues where the data
629 /// is transmitted OOB (ie, on shared disk resource) The producer
630 /// can call setValue() to indicate how far it has completed. The consumer
631 /// can invoke waitValue() to idle until the setValue is equal or
632 /// greater than the waitValue.
633 ///
634 /// These calls will all block until success, error, or interrupt.
635 ///
637 {
638 public:
639  UT_NetBarrier(const UT_StringHolder &trackeraddr, int trackerport,
640  const UT_StringHolder &jobname);
641  virtual ~UT_NetBarrier();
642 
643  /// Tells the tracker to update the barrier value to the given
644  /// value. Does not listen for a tracker response.
645  void setValue(int val);
646 
647  /// Requests the tracker to alert us when the given value is
648  /// reached on the barrier.
649  void waitValue(int val);
650 
651  /// Returns current value of the barrier and then increments
652  /// the barrier's value.
653  /// Blocks until the tracker responds.
654  int incrementValue(int defaultval);
655 
656 protected:
657  /// Creates and posts a message for the tracker.
658  void sendTrackerMessage(const char *msg, int value);
659 
660  /// A simplified method for running the message pump until
661  /// the system errors or is interrupted.
662  void blockUntilComplete();
663 
664  /// Returns true until the barrier has been resolved or error
665  /// occurs
666  bool pumpData(int timeoutms);
667 
670  bool myError;
671 
673 
677 };
678 
679 
680 #endif
681 
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:13
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:31
UT_ValArray< UT_NetMessage * > myWaitingForPeers
int8 extractInt8(exint offset)
long long int64
Definition: SYS_Types.h:107
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:116
bool processDataLoop(UT_Array< UT_NetMessage * > &complist, int expectedmessages, CallbackType callback, int timeoutms=100)
void setState(TransmitState state)
double fpreal64
Definition: SYS_Types.h:192
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:35
UT_ValArray< UT_NetMessage * > & errored()
void startNetworkTimer()
exint compressionThreshold() const
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:453
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:33
void setWriteDataWithHeader(exint headersize, const char *data)
float fpreal32
Definition: SYS_Types.h:191
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