On Thu, Feb 16, 2023 at 10:59 PM Michael Paquier <mich...@paquier.xyz> wrote: > I am adding Stephen Frost > in CC to see if he has any comments about all this part of the logic > with gssencmode.
Sounds good. > I agree that > PQconnectPoll() has grown beyond the point of making it easy to > maintain. I am wondering which approach we could take when it comes > to simplify something like that. Attempting to reduce the number of > flags stored in PGconn would be one. The second may be to split the > internal logic into more functions, for each state we are going > through? The first may lead to an even cleaner logic for the second > point. Yeah, a mixture of both might be helpful -- the first to reduce the inputs to the state machine; the second to reduce interdependencies between cases, the distance of the potential goto jumps, and the number of state machine outputs. (When cases are heavily dependent on each other, probably best to handle them in the same function?) Luckily it looks like the current machine is usually linear. Thanks, --Jacob