File: conn.h

package info (click to toggle)
apt-cacher-ng 0.7.27-1~bpo70+1
  • links: PTS
  • area: main
  • in suites: wheezy-backports
  • size: 1,740 kB
  • sloc: cpp: 13,987; sh: 519; perl: 442; ansic: 414; makefile: 77
file content (76 lines) | stat: -rw-r--r-- 1,532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

#ifndef _CON_H
#define _CON_H

#include "config.h"
#include "lockable.h"

#include <list>
#include <string>

#define RBUFLEN 16384

class dlcon;
class job;
class header;

class con;
typedef SHARED_PTR<con> tConPtr;

class con // : public tRunable
{
   public:
      con(int fdId, const char *client);
      virtual ~con();
      
      void WorkLoop();
      
      void LogDataCounts(const mstring & file,
    		  const char *xff,
    		  off_t countIn, off_t countOut, bool bFileIsError);
      
   private:
	   con& operator=(const con&);// { /* ASSERT(!"Don't copy con objects"); */ };
	   con(const con&);// { /* ASSERT(!"Don't copy con objects"); */ };

	      //! Terminate the connection descriptors gracefully
	      void ShutDown();



      int m_confd;
      
      MYSTD::list<job*> m_jobs2send;
      
#ifdef KILLABLE
      // to awake select with dummy data
      int wakepipe[2];
#endif
      
      bool m_bStopActivity;
      
      pthread_t m_dlerthr;
      
      // for jobs
      friend class job;
      bool SetupDownloader(const char *xff);
      dlcon * m_pDlClient;
      mstring m_sClientHost;
      header *m_pTmpHead;
      
      struct __tlogstuff
      {
    	  mstring file, client;
    	  off_t sumIn, sumOut;
    	  bool bFileIsError;
    	  void write();
    	  void reset(const mstring &pNewFile, const mstring &pNewClient, bool bIsError);
    	  inline __tlogstuff() : sumIn(0), sumOut(0), bFileIsError(false) {}
      } logstuff;

#ifdef DEBUG
      UINT m_nProcessedJobs;
#endif
};

#endif