Author: bryanduxbury
Date: Thu Sep 2 00:56:53 2010
New Revision: 991785
URL: http://svn.apache.org/viewvc?rev=991785&view=rev
Log:
THRIFT-756. cpp: Exposing TSocket(int) constructor to public
This patch changes the raw socket handle constructor from protected to public.
Patch: Rajat Goel
Modified:
incubator/thrift/trunk/lib/cpp/src/transport/TSocket.cpp
incubator/thrift/trunk/lib/cpp/src/transport/TSocket.h
incubator/thrift/trunk/lib/cpp/src/transport/TTransportException.h
Modified: incubator/thrift/trunk/lib/cpp/src/transport/TSocket.cpp
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/transport/TSocket.cpp?rev=991785&r1=991784&r2=991785&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/transport/TSocket.cpp (original)
+++ incubator/thrift/trunk/lib/cpp/src/transport/TSocket.cpp Thu Sep 2
00:56:53 2010
@@ -127,7 +127,7 @@ bool TSocket::peek() {
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);
@@ -235,7 +235,7 @@ void TSocket::openConnection(struct addr
void TSocket::open() {
if (isOpen()) {
- throw TTransportException(TTransportException::ALREADY_OPEN);
+ return;
}
// Validate port number
Modified: incubator/thrift/trunk/lib/cpp/src/transport/TSocket.h
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/transport/TSocket.h?rev=991785&r1=991784&r2=991785&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/transport/TSocket.h (original)
+++ incubator/thrift/trunk/lib/cpp/src/transport/TSocket.h Thu Sep 2 00:56:53
2010
@@ -193,13 +193,12 @@ class TSocket : public TTransport {
*/
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);
Modified: incubator/thrift/trunk/lib/cpp/src/transport/TTransportException.h
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/transport/TTransportException.h?rev=991785&r1=991784&r2=991785&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/transport/TTransportException.h
(original)
+++ incubator/thrift/trunk/lib/cpp/src/transport/TTransportException.h Thu Sep
2 00:56:53 2010
@@ -41,13 +41,12 @@ class TTransportException : public apach
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() :
@@ -89,7 +88,6 @@ class TTransportException : public apach
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";