This patch changes the raw socket handle constructor from protected to public.
Patch: Rajat Goel
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991785
13f79535-47bb-0310-9956-
ffa450edef68
void TSocket::openConnection(struct addrinfo *res) {
if (isOpen()) {
- throw TTransportException(TTransportException::ALREADY_OPEN);
+ return;
}
socket_ = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
void TSocket::open() {
if (isOpen()) {
- throw TTransportException(TTransportException::ALREADY_OPEN);
+ return;
}
// Validate port number
*/
static bool getUseLowMinRto();
- protected:
/**
- * Constructor to create socket from raw UNIX handle. Never called directly
- * but used by the TServerSocket class.
+ * Constructor to create socket from raw UNIX handle.
*/
TSocket(int socket);
+ protected:
/** connect, called by open */
void openConnection(struct addrinfo *res);
enum TTransportExceptionType
{ UNKNOWN = 0
, NOT_OPEN = 1
- , ALREADY_OPEN = 2
- , TIMED_OUT = 3
- , END_OF_FILE = 4
- , INTERRUPTED = 5
- , BAD_ARGS = 6
- , CORRUPTED_DATA = 7
- , INTERNAL_ERROR = 8
+ , TIMED_OUT = 2
+ , END_OF_FILE = 3
+ , INTERRUPTED = 4
+ , BAD_ARGS = 5
+ , CORRUPTED_DATA = 6
+ , INTERNAL_ERROR = 7
};
TTransportException() :
switch (type_) {
case UNKNOWN : return "TTransportException: Unknown transport exception";
case NOT_OPEN : return "TTransportException: Transport not open";
- case ALREADY_OPEN : return "TTransportException: Transport already open";
case TIMED_OUT : return "TTransportException: Timed out";
case END_OF_FILE : return "TTransportException: End of file";
case INTERRUPTED : return "TTransportException: Interrupted";