]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/netunit.cpp
Removed unexpected printf from servconf library.
[stg.git] / stglibs / srvconf.lib / netunit.cpp
index baf02004930b76984495a16b55142466889ec172..24d7ae770e60d1662f4d1573ae4ca7e339c39c88 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <algorithm> // std::min
 
-#include <cstdio>
 #include <cerrno>
 #include <cstring>
 #include <cassert>
@@ -45,8 +44,6 @@ using namespace STG;
 namespace
 {
 
-const std::string::size_type MAX_XML_CHUNK_LENGTH = 2048;
-
 struct ReadState
 {
     bool final;
@@ -124,7 +121,7 @@ if (!localAddress.empty())
         struct hostent * phe = gethostbyname(localAddress.c_str());
         if (phe == NULL)
             {
-            errorMsg = "DNS error.\nCan not reslove " + localAddress;
+            errorMsg = "Can not reslove '" + localAddress + "'";
             return st_dns_err;
             }
 
@@ -156,7 +153,7 @@ if (ip == INADDR_NONE)
     struct hostent * phe = gethostbyname(server.c_str());
     if (phe == NULL)
         {
-        errorMsg = "DNS error.\nCan not reslove " + server;
+        errorMsg = "Can not reslove '" + server + "'";
         return st_dns_err;
         }
 
@@ -235,7 +232,6 @@ char buffer[sizeof(STG_HEADER) + 1];
 
 if (!ReadAll(sock, buffer, strlen(OK_HEADER)))
     {
-    printf("Receive header answer error: '%s'\n", strerror(errno));
     errorMsg = RECV_HEADER_ANSWER_ERROR;
     return st_recv_fail;
     }
@@ -276,7 +272,6 @@ char buffer[sizeof(OK_LOGIN) + 1];
 
 if (!ReadAll(sock, buffer, strlen(OK_LOGIN)))
     {
-    printf("Receive login answer error: '%s'\n", strerror(errno));
     errorMsg = RECV_LOGIN_ANSWER_ERROR;
     return st_recv_fail;
     }
@@ -319,7 +314,6 @@ char buffer[sizeof(OK_LOGINS) + 1];
 
 if (!ReadAll(sock, buffer, strlen(OK_LOGINS)))
     {
-    printf("Receive secret login answer error: '%s'\n", strerror(errno));
     errorMsg = RECV_LOGIN_ANSWER_ERROR;
     return st_recv_fail;
     }
@@ -343,7 +337,7 @@ int NETTRANSACT::TxData(const std::string & text)
 {
 STG::ENCRYPT_STREAM stream(password, TxCrypto, this);
 stream.Put(text.c_str(), text.length() + 1, true);
-if (!stream.isOk())
+if (!stream.IsOk())
     {
     errorMsg = SEND_DATA_ERROR;
     return st_send_fail;
@@ -362,12 +356,11 @@ while (!state.final)
     ssize_t res = read(sock, buffer, sizeof(buffer));
     if (res < 0)
         {
-        printf("Receive data error: '%s'\n", strerror(errno));
         errorMsg = RECV_DATA_ANSWER_ERROR;
         return st_recv_fail;
         }
     stream.Put(buffer, res, res == 0);
-    if (!stream.isOk())
+    if (!stream.IsOk())
         return st_xml_parse_error;
     }