Changeset 14 in cheroxy for trunk/src/main.cpp
- Timestamp:
- 10/24/12 11:12:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main.cpp
r6 r14 42 42 __stream << __message; \ 43 43 string __string = __stream.str (); \ 44 sprintf (__error, "[%s][%d] %d :%s\n", __func__, __LINE__, __code, __string.c_str ()); \44 sprintf (__error, "[%s][%d] (%d) %s\n", __func__, __LINE__, __code, __string.c_str ()); \ 45 45 cout << __error; \ 46 46 } while (0) … … 54 54 int main (int argc, char* argv[]) 55 55 { 56 int aResult = 0;57 const u shortaPort = 8080;56 int aResult = 0; 57 const unsigned short aPort = 8080; 58 58 59 59 CRXSocket aSocket; … … 119 119 CRXProxyThread (void * aThreadArg) 120 120 { 121 int aResult = 0;122 int aReceivedSize = 0;123 int aSentSize = 0;124 125 const u intaBufferSize = 1024 * 64;126 char aBuffer[aBufferSize] = {0x00, };127 128 CRXHttpRequest aHttpRequest;129 CRXHttpResponse aHttpResponse;130 string aUrl = "";131 string aHost = "";132 int aPort = 0;133 134 CRXSocket aWebServer;135 CRXSocket aWebBrowser = ((CRXProxyThreadArgs *)aThreadArg)->mSocket;136 137 bool aIsMoreRequest = false;121 int aResult = 0; 122 int aReceivedSize = 0; 123 int aSentSize = 0; 124 125 const unsigned int aBufferSize = 1024 * 64; 126 char aBuffer[aBufferSize] = {0x00, }; 127 128 CRXHttpRequest aHttpRequest; 129 CRXHttpResponse aHttpResponse; 130 string aUrl = ""; 131 string aHost = ""; 132 int aPort = 0; 133 134 CRXSocket aWebServer; 135 CRXSocket aWebBrowser = ((CRXProxyThreadArgs *)aThreadArg)->mSocket; 136 137 bool aIsMoreRequest = false; 138 138 /*----------------------------------------------------------------*/ 139 139 delete (CRXProxyThreadArgs *)aThreadArg; … … 145 145 if (aReceivedSize < 0) 146 146 { 147 CRX_PRINT_ERROR (aReceivedSize, "failed to receive from client"); 148 aResult = CRX_ERROR (); 147 CRX_PRINT_ERROR (aReceivedSize, "failed to receive from client (" << CRX_ERROR () << ")"); 149 148 return aResult; 150 149 } … … 157 156 158 157 /* connect */ 159 aResult = aWebServer.Connect (aHttpRequest.GetHost (), aHttpRequest.GetPort () );158 aResult = aWebServer.Connect (aHttpRequest.GetHost (), aHttpRequest.GetPort (), 1); 160 159 if (aResult < 0) 161 160 { 162 CRX_PRINT_ERROR (aResult, "failed to connect to server <" << aHost << ":" << aPort << ">"); 163 aResult = CRX_ERROR (); 161 CRX_PRINT_ERROR (aResult, "failed to connect to server <" << aHost << ":" << aPort << "> (" << CRX_ERROR () << ")"); 164 162 return aResult; 165 163 } … … 170 168 if (aSentSize != aReceivedSize) 171 169 { 172 CRX_PRINT_ERROR (aResult, "failed to send to server"); 173 aResult = CRX_ERROR (); 170 CRX_PRINT_ERROR (aResult, "failed to send to server (" << CRX_ERROR () << ")"); 174 171 return aResult; 175 172 } … … 183 180 if (aReceivedSize < 0) 184 181 { 185 CRX_PRINT_ERROR (aReceivedSize, "failed to receive"); 186 aResult = CRX_ERROR (); 182 CRX_PRINT_ERROR (aReceivedSize, "failed to receive (" << CRX_ERROR () << ")"); 187 183 break; 188 184 } … … 196 192 if (aSentSize != aReceivedSize) 197 193 { 198 CRX_PRINT_ERROR (aSentSize, "failed to send"); 199 aResult = CRX_ERROR (); 194 CRX_PRINT_ERROR (aSentSize, "failed to send (" << CRX_ERROR () << ")"); 200 195 break; 201 196 }
Note:
See TracChangeset
for help on using the changeset viewer.