1 2 #ifndef _CON_H 3 #define _CON_H 4 5 #include "config.h" 6 #include "lockable.h" 7 8 #include <list> 9 #include <string> 10 11 #define RBUFLEN 16384 12 13 namespace acng 14 { 15 16 class dlcon; 17 class job; 18 class header; 19 20 class conn; 21 typedef SHARED_PTR<conn> tConPtr; 22 23 class conn // : public tRunable 24 { 25 public: 26 conn(int fdId, const char *client); 27 virtual ~conn(); 28 29 void WorkLoop(); 30 31 private: 32 conn& operator=(const conn&);// { /* ASSERT(!"Don't copy con objects"); */ }; 33 conn(const conn&);// { /* ASSERT(!"Don't copy con objects"); */ }; 34 35 //! Terminate the connection descriptors gracefully 36 void ShutDown(); 37 38 39 40 int m_confd; 41 42 std::list<job*> m_jobs2send; 43 44 #ifdef KILLABLE 45 // to awake select with dummy data 46 int wakepipe[2]; 47 #endif 48 49 bool m_bStopActivity; 50 51 pthread_t m_dlerthr; 52 53 // for jobs 54 friend class job; 55 bool SetupDownloader(const char *xff); 56 dlcon * m_pDlClient; 57 mstring m_sClientHost; 58 header *m_pTmpHead; 59 60 // some accounting 61 mstring logFile, logClient; 62 off_t fileTransferIn = 0, fileTransferOut = 0; 63 bool m_bLogAsError = false; 64 void writeAnotherLogRecord(const mstring &pNewFile, const mstring &pNewClient); 65 66 // This method collects the logged data counts for certain file. 67 // Since the user might restart the transfer again and again, the counts are accumulated (for each file path) 68 void LogDataCounts(cmstring & file, const char *xff, off_t countIn, off_t countOut, 69 bool bAsError); 70 71 #ifdef DEBUG 72 unsigned m_nProcessedJobs; 73 #endif 74 }; 75 76 } 77 78 #endif 79