// Wildcard address
error = getaddrinfo(NULL, port, &hints, &res0);
if (error) {
- string errStr = "TNonblockingServer::serve() getaddrinfo " + string(gai_strerror(error));
- GlobalOutput(errStr.c_str());
- return;
+ throw TException("TNonblockingServer::serve() getaddrinfo " +
+ string(gai_strerror(error)));
}
// Pick the ipv6 address first since ipv4 addresses can be mapped
if (::bind(s, res->ai_addr, res->ai_addrlen) == -1) {
::close(s);
freeaddrinfo(res0);
- throw TException("TNonblockingServer::serve() bind");
+ throw TTransportException(TTransportException::NOT_OPEN,
+ "TNonblockingServer::serve() bind",
+ errno);
}
// Done with the addr info
shared_ptr<TProtocol> inputProtocol;
shared_ptr<TProtocol> outputProtocol;
- try {
- // Start the server listening
- serverTransport_->listen();
- } catch (TTransportException& ttx) {
- string errStr = string("TSimpleServer::run() listen(): ") + ttx.what();
- GlobalOutput(errStr.c_str());
- return;
- }
+ // Start the server listening
+ serverTransport_->listen();
// Run the preServe event
if (eventHandler_ != NULL) {
shared_ptr<TProtocol> inputProtocol;
shared_ptr<TProtocol> outputProtocol;
- try {
- // Start the server listening
- serverTransport_->listen();
- } catch (TTransportException& ttx) {
- string errStr = string("TThreadPoolServer::run() listen(): ") + ttx.what();
- GlobalOutput(errStr.c_str());
- return;
- }
+ // Start the server listening
+ serverTransport_->listen();
// Run the preServe event
if (eventHandler_ != NULL) {
shared_ptr<TProtocol> inputProtocol;
shared_ptr<TProtocol> outputProtocol;
- try {
- // Start the server listening
- serverTransport_->listen();
- } catch (TTransportException& ttx) {
- string errStr = string("TThreadedServer::run() listen(): ") +ttx.what();
- GlobalOutput(errStr.c_str());
- return;
- }
+ // Start the server listening
+ serverTransport_->listen();
// Run the preServe event
if (eventHandler_ != NULL) {
}
GlobalOutput(errbuf);
close();
- throw TTransportException(TTransportException::NOT_OPEN, "Could not bind");
+ throw TTransportException(TTransportException::NOT_OPEN, "Could not bind",
+ errno);
}
// Call listen