]> git.sesse.net Git - cubemap/blobdiff - httpinput.cpp
Release Cubemap 1.3.0.
[cubemap] / httpinput.cpp
index bf8a8b1dd22e609d6611193ae1cf327c96c3d758..a45a4ba00e2ef99031beddd7c449719174c4dd15 100644 (file)
@@ -76,7 +76,9 @@ HTTPInput::HTTPInput(const InputProto &serialized)
          http_header(serialized.http_header()),
          stream_header(serialized.stream_header()),
          has_metacube_header(serialized.has_metacube_header()),
-         sock(serialized.sock())
+         sock(serialized.sock()),
+         num_connection_attempts(0),
+         suppress_logging(false)
 {
        pending_data.resize(serialized.pending_data().size());
        memcpy(&pending_data[0], serialized.pending_data().data(), serialized.pending_data().size());
@@ -93,6 +95,9 @@ HTTPInput::HTTPInput(const InputProto &serialized)
        } else {
                stats.connect_time = time(NULL);
        }
+
+       last_verbose_connection.tv_sec = -3600;
+       last_verbose_connection.tv_nsec = 0;
 }
 
 void HTTPInput::close_socket()
@@ -136,8 +141,10 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port)
        addrinfo *ai;
        int err = getaddrinfo(host.c_str(), port.c_str(), NULL, &ai);
        if (err != 0) {
-               log(WARNING, "[%s] Lookup of '%s' failed (%s).",
-                       url.c_str(), host.c_str(), gai_strerror(err));
+               if (!suppress_logging) {
+                       log(WARNING, "[%s] Lookup of '%s' failed (%s).",
+                               url.c_str(), host.c_str(), gai_strerror(err));
+               }
                return -1;
        }
 
@@ -205,8 +212,10 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port)
        }
 
        // Give the last one as error.
-       log(WARNING, "[%s] Connect to '%s' failed (%s)",
-               url.c_str(), host.c_str(), strerror(errno));
+       if (!suppress_logging) {
+               log(WARNING, "[%s] Connect to '%s' failed (%s)",
+                       url.c_str(), host.c_str(), strerror(errno));
+       }
        freeaddrinfo(base_ai);
        return -1;
 }