Thrift fixes for Exceptions and TServerSocket

Summary:
TServerSocket detected file des. 0 as an invalid file des.  This has been fixed.

Reviewed By: Steve

Revert Plan: Revertible

Notes:


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martin Kraemer 2007-02-03 01:59:12 +00:00
parent f23cfd810c
commit 10640d8935
2 changed files with 12 additions and 2 deletions

View File

@ -106,7 +106,7 @@ void TServerSocket::listen() {
}
shared_ptr<TTransport> TServerSocket::acceptImpl() {
if (serverSocket_ <= 0) {
if (serverSocket_ < 0) {
throw TTransportException(TTX_NOT_OPEN, "TServerSocket not listening");
}

View File

@ -1,6 +1,7 @@
#ifndef _THRIFT_TRANSPORT_TTRANSPORTEXCEPTION_H_
#define _THRIFT_TRANSPORT_TTRANSPORTEXCEPTION_H_ 1
#include <boost/lexical_cast.hpp>
#include <string>
namespace facebook { namespace thrift { namespace transport {
@ -54,6 +55,15 @@ class TTransportException : public facebook::thrift::TException {
return type_;
}
virtual const char* what() const throw() {
if (message_.empty()) {
return (std::string("Default Transport Exception: ") +
boost::lexical_cast<std::string>(type_)).c_str();
} else {
return message_.c_str();
}
}
protected:
/** Error code */
TTransportExceptionType type_;