3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Execution Server
5 * ---------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief ExecServer defines.
24 *//*--------------------------------------------------------------------*/
27 #include "deRingBuffer.hpp"
28 #include "deBlockBuffer.hpp"
38 // Times are in milliseconds.
39 LOG_FILE_TIMEOUT = 5000,
40 READ_DATA_TIMEOUT = 500,
42 SERVER_IDLE_THRESHOLD = 10,
43 SERVER_IDLE_SLEEP = 50,
44 FILEREADER_IDLE_SLEEP = 100,
46 LOG_BUFFER_BLOCK_SIZE = 1024,
47 LOG_BUFFER_NUM_BLOCKS = 512,
49 INFO_BUFFER_BLOCK_SIZE = 64,
50 INFO_BUFFER_NUM_BLOCKS = 128,
52 SEND_BUFFER_SIZE = 16*1024,
53 RECV_BUFFER_SIZE = 4*1024,
55 FILEREADER_TMP_BUFFER_SIZE = 1024,
56 SEND_RECV_TMP_BUFFER_SIZE = 4*1024,
58 MIN_MSG_PAYLOAD_SIZE = 32
61 typedef de::RingBuffer<deUint8> ByteBuffer;
62 typedef de::BlockBuffer<deUint8> ThreadedByteBuffer;
64 class Error : public std::runtime_error
67 Error (const std::string& message) : std::runtime_error(message) {}
68 Error (const char* message, const char* expr, const char* file, int line);
71 class ConnectionError : public Error
74 ConnectionError (const std::string& message) : Error(message) {}
77 class ProtocolError : public ConnectionError
80 ProtocolError (const std::string& message) : ConnectionError(message) {}
85 #define XS_FAIL(MSG) throw xs::Error(MSG, "", __FILE__, __LINE__)
86 #define XS_CHECK(X) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) throw xs::Error(NULL, #X, __FILE__, __LINE__); } while(deGetFalse())
87 #define XS_CHECK_MSG(X, MSG) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) throw xs::Error(MSG, #X, __FILE__, __LINE__); } while(deGetFalse())