RE: Timeout parameters - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject RE: Timeout parameters
Date
Msg-id 0A3221C70F24FB45833433255569204D1FBECD0B@G01JPEXMBYT05
Whole thread Raw
In response to RE: Timeout parameters  ("Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>)
Responses RE: Timeout parameters
List pgsql-hackers
Nagaura-san,

The socket_timeout patch needs the following fixes.  Now that others have already tested these patches successfully,
theyappear committable to me.
 


(1)
+        else
+            goto iiv_error;
...
+
+iiv_error:
+    conn->status = CONNECTION_BAD;
+    printfPQExpBuffer(&conn->errorMessage,
+                      libpq_gettext("invalid integer value for socket_timeout\n"));
+    return false;

This goto and its corresponding iiv_error label are redundant.  You can just set the error message and return at the
callsite of parse_int_param().  i.e.:
 

if (!parse_int_param(...))
{
    error processing
    return false;
}
if(conn->socket_timeout > 0 && conn->socket_timeout < 2)
    conn->socket_timeout = 2;

The reason why oom_error label is present is that it is used at multiple places to avoid repeating the same error
processingcode.
 


(2)
+            conn->sock = -1;

Use PGINVALID_SOCKET instead of -1.


Regards
Takayuki Tsunakawa





pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Misleading errors with column references in default expressionsand partition bounds
Next
From: Tom Lane
Date:
Subject: Re: Syntax diagrams in user documentation