<p></p>
<p dir="auto">Thanks for the PR!</p>
<p dir="auto">I would suggest to add a new field to <code>tcp_connection</code> structure, like <code>event</code>, which is set to the event type of closing the tcp connection, so what was removed by current PR:</p>
<pre><code>-                                if (errno == ETIMEDOUT) {
-                                       tcp_emit_closed_event(c, TCP_CLOSED_TIMEOUT);
-                               } else if (errno == ECONNRESET) {
-                                       tcp_emit_closed_event(c, TCP_CLOSED_RESET);
-                               }
</code></pre>
<p dir="auto">becomes like:</p>
<pre><code>                         if (errno == ETIMEDOUT) {
                                        c->event = TCP_CLOSED_TIMEOUT;
                                } else if (errno == ECONNRESET) {
                                        c->event = TCP_CLOSED_RESET;
                                }
</code></pre>
<p dir="auto">Same in other similar cases.</p>
<p dir="auto">Then, when calling the emit function, if the <code>event</code> field is set, then it is used.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2980#issuecomment-999364416">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIWO5GTEYCODDMHCCLUSGAZ3ANCNFSM5KNNWHEQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZLS4W24E3XCLB4PEHTUSGAZ3A5CNFSM5KNNWHE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHOIROQA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/pull/2980/c999364416</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2980#issuecomment-999364416",
"url": "https://github.com/kamailio/kamailio/pull/2980#issuecomment-999364416",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>