Skip to content

martian: improve error logging in response writing#631

Merged
mmatczuk merged 5 commits intomainfrom
mmt/moderize_martian_v2
Jan 5, 2024
Merged

martian: improve error logging in response writing#631
mmatczuk merged 5 commits intomainfrom
mmt/moderize_martian_v2

Conversation

@mmatczuk
Copy link
Contributor

@mmatczuk mmatczuk commented Jan 3, 2024

This patch extracts response writing to separate method and uses isClosedConnError() for smarter error logging like we do in case if readRequest().

CloseAfrerReply is removed for easier refactoring and later function reuse.

CloseAfterReply was needed to support KGP in SauceConnect 4.9.
It's not needed now.
@mmatczuk mmatczuk force-pushed the mmt/moderize_martian_v2 branch from 6449660 to 882c011 Compare January 3, 2024 15:23
@mmatczuk mmatczuk force-pushed the mmt/moderize_martian_v2 branch from 882c011 to 9f13eaa Compare January 3, 2024 15:38
@mmatczuk mmatczuk changed the title WIP moderize martian martian: improve error logging in response writing Jan 3, 2024
…n connect

In 4b403a3 we added detection of client disconnects.
This extends it with later added isClosedConnError() that enables it on Windows.
if deadlineErr := conn.SetWriteDeadline(time.Now().Add(p.WriteTimeout)); deadlineErr != nil {
log.Errorf(req.Context(), "can't set write deadline: %v", deadlineErr)
}
defer conn.SetWriteDeadline(time.Time{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also reset the timer while reading.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reading it's ok due to tricky code.

@Choraden
Copy link
Contributor

Choraden commented Jan 4, 2024

LGTM.

It looks like the last commit's message references wrong commit.

@mmatczuk mmatczuk merged commit 21a33c5 into main Jan 5, 2024
@mmatczuk mmatczuk deleted the mmt/moderize_martian_v2 branch January 5, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants