mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
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:
parent
f23cfd810c
commit
10640d8935
@ -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");
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {
|
||||
perror("TServerSocket::accept()");
|
||||
throw TTransportException(TTX_UNKNOWN, "ERROR:" + errno);
|
||||
}
|
||||
|
||||
|
||||
shared_ptr<TSocket> client(new TSocket(clientSocket));
|
||||
if (sendTimeout_ > 0) {
|
||||
client->setSendTimeout(sendTimeout_);
|
||||
|
@ -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 {
|
||||
@ -53,6 +54,15 @@ class TTransportException : public facebook::thrift::TException {
|
||||
TTransportExceptionType getType() {
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user