IsClientDisconnectError checks if the error is due to client disconnecting e.g. user seeking in video, stopping playback, or network issues on client side
(err error)
| 30 | // IsClientDisconnectError checks if the error is due to client disconnecting |
| 31 | // e.g. user seeking in video, stopping playback, or network issues on client side |
| 32 | func IsClientDisconnectError(err error) bool { |
| 33 | if err == nil { |
| 34 | return false |
| 35 | } |
| 36 | errStr := err.Error() |
| 37 | return strings.Contains(errStr, "connection was aborted") || |
| 38 | strings.Contains(errStr, "connection reset by peer") || |
| 39 | strings.Contains(errStr, "broken pipe") || |
| 40 | strings.Contains(errStr, "forcibly closed") |
| 41 | } |
| 42 | |
| 43 | // telegram helper functions |
| 44 | // TODO: move these to a separate package if they grow too large |