Clean-ups and fixes to compile with more warnings enabled and with g++.
[invirt/third/libt4.git] / rpc / connection.cc
index b29e136..c4edbf6 100644 (file)
@@ -6,6 +6,8 @@
 #include <unistd.h>
 #include "marshall.h"
 
 #include <unistd.h>
 #include "marshall.h"
 
+connection_delegate::~connection_delegate() {}
+
 connection::connection(connection_delegate * delegate, socket_t && f1, int l1)
 : fd(move(f1)), delegate_(delegate), lossy_(l1)
 {
 connection::connection(connection_delegate * delegate, socket_t && f1, int l1)
 : fd(move(f1)), delegate_(delegate), lossy_(l1)
 {
@@ -31,7 +33,7 @@ connection::~connection() {
     VERIFY(!wpdu_.buf.size());
 }
 
     VERIFY(!wpdu_.buf.size());
 }
 
-shared_ptr<connection> connection::to_dst(const sockaddr_in &dst, connection_delegate * delegate, int lossy) {
+shared_ptr<connection> connection::to_dst(const sockaddr_in & dst, connection_delegate * delegate, int lossy) {
     socket_t s = socket(AF_INET, SOCK_STREAM, 0);
     s.setsockopt(IPPROTO_TCP, TCP_NODELAY, (int)1);
     if (connect(s, (sockaddr*)&dst, sizeof(dst)) < 0) {
     socket_t s = socket(AF_INET, SOCK_STREAM, 0);
     s.setsockopt(IPPROTO_TCP, TCP_NODELAY, (int)1);
     if (connect(s, (sockaddr*)&dst, sizeof(dst)) < 0) {
@@ -204,7 +206,7 @@ connection_listener::connection_listener(connection_delegate * delegate, in_port
     tcp_.setsockopt(SOL_SOCKET, SO_RCVTIMEO, timeval{0, 50000});
     tcp_.setsockopt(SOL_SOCKET, SO_SNDTIMEO, timeval{0, 50000});
 
     tcp_.setsockopt(SOL_SOCKET, SO_RCVTIMEO, timeval{0, 50000});
     tcp_.setsockopt(SOL_SOCKET, SO_SNDTIMEO, timeval{0, 50000});
 
-    sockaddr_in sin{}; // zero initialize
+    sockaddr_in sin = sockaddr_in(); // zero initialize
     sin.sin_family = AF_INET;
     sin.sin_port = hton(port);
 
     sin.sin_family = AF_INET;
     sin.sin_port = hton(port);
 
@@ -237,7 +239,7 @@ void connection_listener::read_cb(int) {
     int s1 = accept(tcp_, (sockaddr *)&sin, &slen);
     if (s1 < 0) {
         perror("connection_listener::accept_conn error");
     int s1 = accept(tcp_, (sockaddr *)&sin, &slen);
     if (s1 < 0) {
         perror("connection_listener::accept_conn error");
-        throw thread_exit_exception();
+        throw runtime_error("connection listener failure");
     }
 
     IF_LEVEL(2) LOG("accept_loop got connection fd=" << s1 << " " << inet_ntoa(sin.sin_addr) << ":" << ntoh(sin.sin_port));
     }
 
     IF_LEVEL(2) LOG("accept_loop got connection fd=" << s1 << " " << inet_ntoa(sin.sin_addr) << ":" << ntoh(sin.sin_port));