Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2029edb8
Unverified
Commit
2029edb8
authored
Aug 29, 2023
by
inphi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dup waitErr chan read
parent
877fcf88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
12 deletions
+3
-12
run.go
cannon/cmd/run.go
+0
-9
filepoller.go
op-preimage/filepoller.go
+3
-3
No files found.
cannon/cmd/run.go
View file @
2029edb8
...
...
@@ -188,15 +188,6 @@ func (p *ProcessPreimageOracle) Close() error {
if
p
.
cmd
==
nil
{
return
nil
}
// We first check if the process has already exited before signaling.
// Note: This is a teeny bit racy since the process could exit after the check
// above and another process is assigned the same pid.
select
{
case
err
:=
<-
p
.
waitErr
:
return
err
case
<-
time
.
After
(
time
.
Second
*
1
)
:
// give the wait goroutine time to reap process
}
_
=
p
.
cmd
.
Process
.
Signal
(
os
.
Interrupt
)
return
<-
p
.
waitErr
}
...
...
op-preimage/filepoller.go
View file @
2029edb8
...
...
@@ -8,7 +8,7 @@ import (
)
// FilePoller is a ReadWriteCloser that polls the underlying file channel for reads and writes
// until its context is done. This is useful
in detecting
when the other end of a
// until its context is done. This is useful
to detect
when the other end of a
// blocking pre-image channel is no longer available.
type
FilePoller
struct
{
File
FileChannel
...
...
@@ -27,7 +27,7 @@ func (f *FilePoller) Read(b []byte) (int, error) {
var
read
int
for
{
if
err
:=
f
.
File
.
Reader
()
.
SetReadDeadline
(
time
.
Now
()
.
Add
(
f
.
pollTimeout
));
err
!=
nil
{
panic
(
err
)
return
0
,
err
}
n
,
err
:=
f
.
File
.
Read
(
b
[
read
:
])
if
errors
.
Is
(
err
,
os
.
ErrDeadlineExceeded
)
{
...
...
@@ -47,7 +47,7 @@ func (f *FilePoller) Write(b []byte) (int, error) {
var
written
int
for
{
if
err
:=
f
.
File
.
Writer
()
.
SetWriteDeadline
(
time
.
Now
()
.
Add
(
f
.
pollTimeout
));
err
!=
nil
{
panic
(
err
)
return
0
,
err
}
n
,
err
:=
f
.
File
.
Write
(
b
[
written
:
])
if
errors
.
Is
(
err
,
os
.
ErrDeadlineExceeded
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment