0002-Never-abort-when-printing-socket-exceptions-in-src-r.patch

J. Moringen, 04/30/2014 11:26 AM

Download (2.26 KB)

View differences:

src/rsb/transport/socket/BusConnection.cpp
46 46
namespace transport {
47 47
namespace socket {
48 48

  
49
std::string safeSocketExceptionString(const std::exception& exception) {
50
    try {
51
        return exception.what();
52
    } catch (...) {
53
        return "<failed to determine exception message>";
54
    }
55
}
56

  
49 57
BusConnection::BusConnection(BusPtr    bus,
50 58
                             SocketPtr socket,
51 59
                             bool      client,
......
158 166
        try {
159 167
            disconnect();
160 168
        } catch (const std::exception& e) {
161
            RSCDEBUG(logger, "Failed to disconnect (in " << context << "): "
162
                     << e.what())
169
            RSCDEBUG(this->logger, "Failed to disconnect (in " << context << "): "
170
                     << safeSocketExceptionString(e));
163 171
        }
164 172
    }
165 173
}
......
183 191
                try {
184 192
                    shutdown();
185 193
                } catch (const std::exception& e) {
186
                    RSCWARN(this->logger, "Failed to shut down socket: " << e.what());
194
                    RSCWARN(this->logger, "Failed to shut down socket: "
195
                            << safeSocketExceptionString(e));
187 196
                }
188 197
            }
189 198
            performSafeCleanup("handleReadLength[eof]");
190
-