-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Program errors out due to no ping API response despite API responding (…
…#431) * Program errors out due to no ping API response despite API responding Fixes #393 * add API trace for ping and validate connection * fix linter
- Loading branch information
Showing
4 changed files
with
60 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package fshelper | ||
|
||
import "io" | ||
|
||
type teeReadCloser struct { | ||
r io.ReadCloser | ||
w io.Writer | ||
} | ||
|
||
func (t *teeReadCloser) Read(p []byte) (n int, err error) { | ||
n, err = t.r.Read(p) | ||
if n > 0 { | ||
if n, err := t.w.Write(p[:n]); err != nil { | ||
return n, err | ||
} | ||
} | ||
return | ||
} | ||
|
||
func (t *teeReadCloser) Close() error { | ||
return t.r.Close() | ||
} | ||
|
||
func TeeReadCloser(r io.ReadCloser, w io.Writer) io.ReadCloser { | ||
return &teeReadCloser{r: r, w: w} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters