#include <TFTP_Sender.hpp>
Inheritance diagram for TFTP_Sender::
Public Methods | |
TFTP_Sender () | |
virtual void | run () |
Private Methods | |
void | sendData () |
TFTP_Sender (const TFTP_Sender &src) | |
const TFTP_Sender & | operator= (const TFTP_Sender &src) |
Private Attributes | |
size_t | blocksize |
size_t | windowsize |
size_t | currentDataNo |
size_t | currentBlockNo |
double | timeout |
TFTP_Packet * | packet |
|
Definition at line 14 of file TFTP_Sender.cpp. 00014 : Basic_PThread() 00015 { 00016 timeout = (double)option.getTimeOutValue(); 00017 packet = NULL; 00018 currentDataNo = 0; 00019 00020 // Incremented by Acknowledge packet 00021 option.windowsizeLeft = option.getWindowSizeValue(); 00022 00023 printf("Creating Sender...\n"); 00024 fflush( stdout ); 00025 } |
|
|
|
|
|
Reimplemented from Basic_PThread. Definition at line 49 of file TFTP_Sender.cpp. 00050 { 00051 printf("Starting Sender...\n"); 00052 fflush( stdout ); 00053 00054 00055 for( currentDataNo = 1; 00056 currentDataNo <= option.LastData; // && option.Done == FALSE; 00057 currentDataNo++ ) 00058 { 00059 00060 00061 // If there is nothing then let other folks run. 00062 while( option.data_queue->isEmpty() ) { 00063 sched_yield(); 00064 } 00065 00066 //If the there window size is 0, then wait till it get's bigger 00067 while( option.windowsizeLeft < 1 ) 00068 { 00069 sched_yield(); 00070 } 00071 00072 sendData(); 00073 sched_yield(); 00074 00075 } 00076 00077 printf("Ending Sender...\n"); 00078 exit(1); 00079 00080 fflush( stdout ); 00081 } |
|
Definition at line 27 of file TFTP_Sender.cpp. Referenced by run().
00028 { 00029 option.rwlock5_data_queue.read(); 00030 packet = option.data_queue->dequeue(); 00031 option.rwlock5_data_queue.releaseRead(); 00032 00033 packet->send(); 00034 00035 option.rwlock6_wait_queue.write(); 00036 packet->setTimeStamp( option.currentTime + timeout ); 00037 00038 // First time sent. 00039 packet->resent = 0; 00040 //printf("The windowsizeLeft is %d\n",option.windowsizeLeft); 00041 option.rwlock1_global.write(); 00042 option.windowsizeLeft--; 00043 option.rwlock1_global.releaseWrite(); 00044 00045 option.waitingAck_queue->enqueue( packet ); 00046 option.rwlock6_wait_queue.releaseWrite(); 00047 } |
|
Definition at line 23 of file TFTP_Sender.hpp. |
|
Definition at line 26 of file TFTP_Sender.hpp. |
|
Definition at line 25 of file TFTP_Sender.hpp. |
|
Definition at line 30 of file TFTP_Sender.hpp. |
|
Definition at line 28 of file TFTP_Sender.hpp. |
|
Definition at line 24 of file TFTP_Sender.hpp. |