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_Interrupt.h"
26 #include "UT_NetSocket.h"
27 #include "UT_NonCopyable.h"
28 #include "UT_ValArray.h"
29 
30 #include <SYS/SYS_Deprecated.h>
31 
32 class UT_StopWatch;
33 
34 ///
35 /// UT_NetMessage bears similarity to a UT_NetPacket in that
36 /// it tries to abstract the necessitiy of retrying TCP/IP streams
37 /// until the message is completely received. However, it is built
38 /// around the idea of having a datapump, pumpData, to handle this,
39 /// allowing one to interleave many messages in one thread using
40 /// select()
41 ///
42 /// Write Protocol:
43 /// STATE_WRITE:
44 /// send 32bit length in network byte order
45 /// if length greater than 1<<31, send 32 bit -1
46 /// followed by 64 bit length in network-byte order.
47 /// send myLength from myData
48 /// STATE_WAITACK:
49 /// receive 'j'
50 /// shutdown the connection
51 ///
52 /// Read Protocol:
53 /// STATE_READ:
54 /// receive 32bit length in network byte order
55 /// if length is -1, receive 64bit length in network byte order.
56 /// set myLength and allocate myData
57 /// receive myLength into myData
58 /// STATE_SENDACK:
59 /// send 'j'
60 /// STATE_READFIN:
61 /// receive '' (ie, wait till safe to close)
62 ///
64 {
65 public:
66  UT_NetMessage();
67 
68  /// Frees the allocated data buffer.
69  ~UT_NetMessage();
70 
72 
73  /// What state we are in.
74  /// Thanks to the vagaries of TCP/IP we need an application
75  /// level ACK to verify the data made it across the wire
76  /// before we do our shutdown.
78  {
80 
81  STATE_READ, /// Read message
82  STATE_SENDACK, /// Send ack
83  STATE_READFIN, /// Connection closed after ack sent.
84 
85  STATE_WRITE, /// Send message
86  STATE_WAITACK, /// Wait for connection ack.
87 
88  STATE_READPIPE, /// Blind read of a pipe for our size
89  STATE_READPIPE_BLOSC, /// Blind read blosc pipe.
91  STATE_WRITEPIPE,/// Blind write of a pipe for our size
93  };
94 
95  /// Sends or receives data from the socket until the message
96  /// is complete. When it is complete or errored, returns true. Returns
97  /// false if you should put it back in the select loop.
98  bool pumpData();
99 
100  /// Trys to connect the socket, if already connected a no-op
101  /// Returns false if still not connected, true if connected or error.
102  /// failed is set to true if the connectionf ailed due to a
103  /// UT_CONNECT_FAILED as opposed to being delayed by a UT_WOULD_BLOCK
104  bool tryConnection(bool *failed=0);
105 
106  /// The socket we are attached to.
107  UT_NetSocket *getSocket() const { return mySocket.get(); }
108  /// File descriptor of socket.
109  int getSocketFD() const { return mySocket->getSocket(); }
110 
111  /// Adds our file descriptor to the select set and update
112  /// maxfd.
113  void addToFDSet(fd_set *set, int &maxfd) const;
114 
115  TransmitState state() const { return myState; }
116  bool isErrored() const { return myErrorState; }
117  void flagErrored() { myErrorState = true; }
118 
119  const char *data() const { return myData; }
120  char *data() { return myData; }
121  exint length() const { return myLength; }
122 
123  /// Resizes, useful for pipe messages.
124  void resetLength(TransmitState state, exint newlen);
125 
126  /// Extracts data from the message, applying proper byteswaps.
127  /// Offset is in bytes. Does not need to be aligned.
128  int64 extractInt64(exint offset);
129  int32 extractInt32(exint offset);
130  fpreal32 extractFloat32(exint offset);
131  fpreal64 extractFloat64(exint offset);
132  int16 extractInt16(exint offset);
133  int8 extractInt8(exint offset);
134 
135  /// Inserts data into the message, applying proper byte swaps.
136  /// Offset is in bytes. Does not need to be aligned.
137  void overwriteInt64(exint offset, int64 val);
138  void overwriteInt32(exint offset, int32 val);
139  void overwriteFloat32(exint offset, fpreal32 val);
140  void overwriteFloat64(exint offset, fpreal64 val);
141  void overwriteInt16(exint offset, int16 val);
142  void overwriteInt8(exint offset, int8 val);
143 
144  /// Determine source/sink of this message.
145  /// Because we shutdown the socket on completion of the
146  /// protocol, we always gain ownership of the socket and
147  /// will handle deleting it ourselves.
148  void setReadSocket(UT_NetSocketPtr socket);
149  void setWriteSocket(UT_NetSocketPtr socket);
150  void setWriteSocket(const char *addr, int port);
151 
152  /// The headersize, in bytes, is prepended as nulls to the message.
153  /// The headersize *is* included in the myLength, the receiver
154  /// doesn't know about the distinction between header and data!
155  void setWriteData(const char *data, exint len)
156  { setWriteDataWithHeader(0, data, len); }
157  void setWriteData(const char *data)
158  { setWriteData(data, strlen(data)); }
159  void setWriteDataWithHeader(exint headersize, const char *data, exint len);
160  void setWriteDataWithHeader(exint headersize, const char *data)
161  { setWriteDataWithHeader(headersize, data, strlen(data)); }
162 
163  /// Allocates a blank write buffer of the given size.
164  /// It is assumed the caller will fill it out by writing to data()
166  { setWriteDataWithHeader(bufsize, 0, 0); }
167 
168  /// Grows a write buffer to this size, must be done before transmitting.
169  /// Existing data is left intact.
170  void growWriteData(exint newlen);
171 
172  static int64 totalBytesSent();
173  static int64 totalBytesReceived();
174  static void clearByteCounters();
175 
176  /// Tracks total network time. This does not include time
177  /// spent in background threads, only the time spent to sync
178  /// up to such threads. This includes transfer time and sync
179  /// time. (It is hard to determine what time spent waiting on
180  /// a pipe is the other system still computing, and what is just
181  /// waiting on the network to transfer data...)
182  /// There is no way to clear this because some load balancing
183  /// systems may want it to properly accumulate between frames
184  static fpreal64 totalNetworkTime();
185 
186  /// Adds the given number of seconds to total network timecounter.
187  static void addToTotalNetworkTime(fpreal64 netnewtime);
188 
189  void setState(TransmitState state) { myState = state; }
190 
191  /// Compresses our data into swap buffer, then swap the pointers
192  /// so we will send the compressed buffer. The header measures the
193  /// number of bytes that will be copied over directly.
194  bool compress(exint header);
195 
196  /// Decompress our block and swap so we point at the decompressed
197  /// buffer. If it fails, it was a corrupt buffer of some sort.
198  /// The header is copied directly.
199  bool decompress(exint header);
200 
201 private:
202 
203  /// Tracking variables.
204  static int64 ourTotalBytesSent;
205  static int64 ourTotalBytesReceived;
206  static fpreal64 ourTotalNetworkTime;
207 
208  UT_NetSocketPtr mySocket;
209  exint myCapacity;
210  exint myLength;
211  char *myData;
212 
213  // When we compress/decompress we swap buffers with this
214  // buffer. We can thus avoid re-creating every frame in cases where
215  // we cache our messages.
216  char *mySwapData;
217  exint mySwapLength;
218  exint mySwapCapacity;
219 
220  TransmitState myState;
221  bool myErrorState;
222 
223  // Internal state of where we are in terms of pumping...
224  // -4 to -1 are for sending the length.
225  exint myDataPos;
226 
227  // Flag if we are pumping the second length.
228  bool myProcessing64BitLength;
229 
230  int32 myNetLength; // htonl version of length, -1 if 64bit
231  int64 myNetLength64; // htonl version of length64
232 };
233 
234 
235 ///
236 /// UT_NetMessagePump
237 ///
238 /// Interleaves processing from possibly many different message
239 /// sources.
240 ///
241 /// postMessage() can be used to queue messages to send after
242 /// their setWriteSocket and setWriteData has been invoked.
243 ///
244 /// listenSocket() will invoke accept() and add to the completed()
245 /// list messages as they are done.
246 ///
247 ///
249 {
250 public:
252  /// On destruction all messages on our internal lists will be destroyed.
254 
256 
257  /// Adds the message to our queue to process.
258  /// We take ownership of the UT_NetMessage until it is removed
259  /// from one of our lists.
260  void postMessage(UT_NetMessage *msg);
261 
262  /// Resets, but does *not* free any messages it has.
263  void reset()
264  {
265  myWorkList.clear();
266  myErrorList.clear();
267  myCompleteList.clear();
268  }
269 
270  /// List of all completed incoming messages.
271  ///
272  /// To process a message from the completed list,
273  /// UT_NetMessage *msg = pump.completed()(i);
274  /// pump.completed()(i) = 0;
275  /// ... use msg ...
276  /// delete msg;
277  UT_ValArray<UT_NetMessage *> &completed() { return myCompleteList; }
278 
279  /// List of messages that have entered the error status.
280  /// This includes failed outgoing messages as well as incomplete
281  /// incoming messages.
282  UT_ValArray<UT_NetMessage *> &errored() { return myErrorList; }
283 
284  /// Starts listening to the given socket for messages
285  /// We do not own this socket, caller should delete it (but not
286  /// before stopping listening or deleting the pump!)
287  /// Connections accepted from this socket will be read
288  /// via UT_NetMessage's protocol.
289  void listenSocket(UT_NetSocket *socket);
290  /// Stops listening from a given socket.
291  void stopListening(UT_NetSocket *socket);
292 
293  /// Processes active messages and listens for incoming messages.
294  /// Returns true if there is the *potential* of more work - if
295  /// listening to a socket this is always true!
296  bool pumpData(int timeoutms);
297 
298  /// The number of messages still pending.
299  int pendingMessages() const { return myWorkList.entries(); }
300 
301  void deleteSentMessages(bool shoulddelete) { myDeleteSent = shoulddelete; }
302  void receiveAnnounce(bool receiveannounce) { myReceiveAnnounce = receiveannounce; }
303 protected:
310 };
311 
313 {
315  int myPort;
316  int myPeer;
317 };
318 
319 ///
320 /// UT_NetExchange
321 ///
322 /// Uses a tracker to exchange data between peers.
323 /// The tracker handles peer discovery and synchronization. A unique
324 /// jobname is used to allow multiple net exchanges to use the same
325 /// tracker.
326 ///
327 /// EXTERNAL PROTOCOL:
328 ///
329 /// UT_NetMessages accepted or returned from this have an 8 byte
330 /// header. The fields are filled out for you on a sendData()
331 /// and can be queried to determine the message source when
332 /// pulling completed messages from the result list.
333 ///
334 /// The first byte is the message type. If it is 'p', it is
335 /// peer data. Users of UT_NetExchange should only see these
336 /// messages as the other are internal tracker messages.
337 /// 'P' is used for blosc compressed peer data, it will be uncompressed
338 /// and revealed to the user as a 'p' data.
339 ///
340 /// extractInt16(4): Destination peer #
341 /// extractInt16(6): Source peer #
342 ///
343 /// Anything 8 and after is user data.
344 ///
345 /// INTERNAL PROTOCOL:
346 ///
347 /// From the tracker:
348 ///
349 /// Message of type 'b' is a barrier value. The 32 bit network
350 /// byte order barrier value starts at offset 1.
351 ///
352 /// Message type of 'c' is a peer list. A space delimited list
353 /// of address port peer triples is present, one for each peer.
354 ///
355 /// Message type of 'd' is a done flag. It informs that all
356 /// the peers have reported done to the tracker.
357 ///
358 /// Message type of 'e' is an error. One of the peers reported
359 /// an error to the tracker that got broadcast back.
360 ///
361 /// To the tracker:
362 ///
363 /// Messages to the tracker all have the format
364 /// command port peer npeer jobname
365 ///
366 /// port is the listen port used by this peer.
367 /// peer is the peer number
368 /// npeer is the number of peers
369 /// jobname is the name of the current job
370 ///
371 /// command is one of:
372 /// acquire: A peer is logging on to this jobname.
373 /// done: A peer has all the data it cares about from the netexchange.
374 /// error: A peer has encountered a fatal network error and wants a clean
375 /// shutdown.
376 /// barrierset: Establish a barrier, the current value is peer.
377 /// barrierwait: Will recevie a done message when the peer value is reached or
378 /// exceeded by the named barrier.
379 ///
381 {
382 public:
383  UT_NetExchange(const UT_StringHolder &trackeraddr, int trackerport,
384  int peer, int npeer, const UT_StringHolder &jobname);
385  ~UT_NetExchange();
386 
388 
390  {
391  public:
392  AutoNetworkTimer(UT_NetExchange *xchg) { myXchg = xchg; myXchg->startNetworkTimer(); }
393  ~AutoNetworkTimer() { myXchg->stopNetworkTimer(); }
394 
395  UT_NON_COPYABLE(AutoNetworkTimer)
396 
397  UT_NetExchange *myXchg;
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>
459  bool processDataLoop(UT_Array<UT_NetMessage *> &complist,
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);
567 
569 
571  {
572  public:
573  AutoNetworkTimer(UT_NetMessagePipe *pipe) { myPipe = pipe; myPipe->startNetworkTimer(); }
574  ~AutoNetworkTimer() { myPipe->stopNetworkTimer(); }
575 
576  UT_NON_COPYABLE(AutoNetworkTimer)
577 
579  };
580 
581 
582  /// Prepares the pipes, returns true if successful.
583  bool openPipes(int timeoutms = 100);
584 
585  /// Shuts down the pipes, returns true if successful.
586  bool closePipes(int timeoutms = 100);
587 
588  /// Run resetLength on the read pipes to setup the desired amount
589  /// to read.
590  /// Likewise, resetLength the write pipes & fill in the data to write.
591  UT_NetMessage *readPipe(int peer) { return myReadPipes(peer); }
592  UT_NetMessage *writePipe(int peer) { return myWritePipes(peer); }
593 
594  /// Flushes all write pipes, fills all read pipes.
595  /// Afterwards the readPipes will have their data filled in.
596  /// Returns true if not errored or aborted.
597  bool transferData(int timeoutms = 100);
598 
599  void setCompressionThreshold(exint threshold_bytes) { myCompressionThreshold = threshold_bytes; }
600  exint compressionThreshold() const { return myCompressionThreshold; }
601 
602 protected:
603  /// Returns true until all the messages have been flushed.
604  bool pumpData(int timeoutms);
605 
606  void startNetworkTimer();
607  void stopNetworkTimer();
608 
612  int myNPeer, myPeer;
618 
619  /// Number of bytes to start compressing at.
621 
622  friend class AutoNetworkTimer;
623 };
624 
625 ///
626 /// UT_NetBarrier
627 ///
628 /// Very similar to UT_NetExchange, using the same tracker. However,
629 /// it is meant for creating producer/consumer queues where the data
630 /// is transmitted OOB (ie, on shared disk resource) The producer
631 /// can call setValue() to indicate how far it has completed. The consumer
632 /// can invoke waitValue() to idle until the setValue is equal or
633 /// greater than the waitValue.
634 ///
635 /// These calls will all block until success, error, or interrupt.
636 ///
638 {
639 public:
640  UT_NetBarrier(const UT_StringHolder &trackeraddr, int trackerport,
641  const UT_StringHolder &jobname);
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.
GLenum GLuint GLsizei bufsize
Definition: glcorearb.h:1818
UT_NetSocket * getSocket() const
The socket we are attached to.
int int32
Definition: SYS_Types.h:39
UT_NetSocketPtr myToSelf
UT_ValArray< UT_NetMessage * > myWorkList
void setWriteData(const char *data, exint len)
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:623
void setWriteData(const char *data)
bool isErrored() const
exint compressionThreshold() const
void setCompressionThreshold(exint threshold_bytes)
UT_StringHolder myJobName
**And then you can **find out if it s done
Definition: thread.h:622
int64 exint
Definition: SYS_Types.h:125
void flagErrored()
void setWriteDataLength(exint bufsize)
UT_ValArray< UT_NetMessage * > myErrorList
UT_ValArray< UT_NetMessage * > myCompleteList
#define UT_API
Definition: UT_API.h:14
Blind read blosc pipe.
Definition: UT_NetMessage.h:90
UT_ValArray< UT_NetMessage * > myAnnounce
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:5750
float fpreal32
Definition: SYS_Types.h:200
UT_ValArray< UT_NetMessage * > myWritePipes
UT_ValArray< UT_NetMessage * > myCompleted
fpreal64 myLastTimerVal
UT_ValArray< UT_NetMessage * > & completed()
double fpreal64
Definition: SYS_Types.h:201
UT_ValArray< UT_NetMessage * > myWaitingForPeers
int8 extractInt8(exint offset)
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:92
AutoNetworkTimer(UT_NetMessagePipe *pipe)
void deleteSentMessages(bool shoulddelete)
UT_ValArray< UT_NetMessage * > myReadPipes
GLintptr offset
Definition: glcorearb.h:665
void setCompressionThreshold(exint threshold_bytes)
const char * data() const
void setState(TransmitState state)
UT_NetMessagePump myPump
UT_NetSocketPtr myToSelf
UT_Array< ut_NetPeerData > myPeerList
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
UT_NetMessagePump myPump
long long int64
Definition: SYS_Types.h:116
Connection closed after ack sent.
Definition: UT_NetMessage.h:85
signed char int8
Definition: SYS_Types.h:35
int getSocketFD() const
File descriptor of socket.
UT_ValArray< UT_NetMessage * > & errored()
void startNetworkTimer()
exint compressionThreshold() const
bool isErrored() const
UT_StringHolder myAddress
exint length() const
bool gotPeerList() const
Returns if we have received a peer list from the tracker.
short int16
Definition: SYS_Types.h:37
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:1608
Blind read of a pipe for our size.
Definition: UT_NetMessage.h:89
**But if you need a or simply need to know when the task has * completed
Definition: thread.h:613
void startNetworkTimer()
UT_StringHolder myJobName
UT_ValArray< UT_NetSocket * > myServerList
Wait for connection ack.
Definition: UT_NetMessage.h:88
Definition: core.h:1131
UT_StringHolder myJobName
UT_NetSocketPtr myToSelf
UT_StringHolder myTrackerAddr
UT_StringHolder myTrackerAddress
exint myCompressionThreshold
Number of bytes to start compressing at.
void setWriteDataWithHeader(exint headersize, const char *data)
AutoNetworkTimer(UT_NetExchange *xchg)
UT_UniquePtr< UT_NetSocket > UT_NetSocketPtr
Definition: UT_NetSocket.h:333
UT_NetMessagePump myPump
Definition: format.h:895
int pendingMessages() const
The number of messages still pending.
UT_StopWatch * myTimer
We track our elapsed time for printing status.
UT_StringHolder myTrackerAddr