Changeset 36 in cheroxy


Ignore:
Timestamp:
11/20/12 19:49:10 (11 years ago)
Author:
cheese
Message:

#1 a interface to set timeout to server socket is added to CRXProxy

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/CRXProxy.h

    r35 r36  
    2424{
    2525private:
    26     bool                mIsIntercepted;
    27 
    2826    CRXSocket           mClient;
    2927    CRXSocket           mServer;
     28
     29    int                 mServerTimeout;
    3030
    3131    CRXHttpRequest      mHttpRequest;
     
    4545
    4646    void    SetClientSocket             (const int  aSocket);
     47    void    SetServerTimeout            (const int  aTimeout = TCPSOCKET_NO_TIMEOUT);
    4748    void    Close                       (void);
    4849
     
    5960    int     Forward                     (void);
    6061
     62    int     ReceiveRequest              (void);
     63    int     SendRequest                 (void);
     64
     65    int     ReceiveResponse             (void);
     66    int     SendResponse                (void);
     67
     68public:
     69    /* HTTP data */
    6170    void    SetHttpRequest              (const char * aHttpRequest);
    6271    char *  GetHttpRequest              (char       * aBuffer,
     
    7281    int     GetHttpResponseBodyLength   (void) const;
    7382   
    74     int     ReceiveRequest              (void);
    75     int     SendRequest                 (void);
    76 
    77     int     ReceiveResponse             (void);
    78     int     SendResponse                (void);
    7983};
    8084
  • trunk/src/CRXProxy.cpp

    r35 r36  
    1010
    1111CRXProxy::CRXProxy (void)
    12     : mIsIntercepted (false),
    13       mClient (0),
    14       mServer (0)
     12    : mClient (0),
     13      mServer (0),
     14      mServerTimeout (0)
    1515{
    1616    /*----------------------------------------------------------------*/
     
    5050
    5151    mClient = aSocket;
     52    /*----------------------------------------------------------------*/
     53}
     54
     55void
     56CRXProxy::SetServerTimeout (const int aTimeout)
     57{
     58    /*----------------------------------------------------------------*/
     59    mServerTimeout = aTimeout;
    5260    /*----------------------------------------------------------------*/
    5361}
     
    273281    {
    274282        /* connect */
    275         aResult = mServer.Connect (mHttpRequest.GetHost (), mHttpRequest.GetPort (), 1);
     283        aResult = mServer.Connect (mHttpRequest.GetHost (), mHttpRequest.GetPort (), mServerTimeout);
    276284        if (aResult < 0)
    277285        {
  • trunk/src/main.cpp

    r35 r36  
    9999
    100100        aProxy->SetClientSocket (aResult);
     101        aProxy->SetServerTimeout (2);
    101102        aProxy->SetRequestFilter (CRX_FILTER_REQUEST_FILE_EXTENSION,
    102103                                  CRX_FILTER_MATCHED,
Note: See TracChangeset for help on using the changeset viewer.