Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-yamux
Commits
ffc68063
Unverified
Commit
ffc68063
authored
Mar 02, 2020
by
Steven Allen
Committed by
GitHub
Mar 02, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14 from Wondertan/ref/rename-error
Rename errors
parents
c7e96b99
7517316e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
const.go
const.go
+18
-18
stream.go
stream.go
+2
-2
No files found.
const.go
View file @
ffc68063
...
...
@@ -5,69 +5,69 @@ import (
"fmt"
)
type
Yamux
Error
struct
{
type
Error
struct
{
msg
string
timeout
,
temporary
bool
}
func
(
ye
Yamux
Error
)
Error
()
string
{
func
(
ye
*
Error
)
Error
()
string
{
return
ye
.
msg
}
func
(
ye
Yamux
Error
)
Timeout
()
bool
{
func
(
ye
*
Error
)
Timeout
()
bool
{
return
ye
.
timeout
}
func
(
ye
Yamux
Error
)
Temporary
()
bool
{
func
(
ye
*
Error
)
Temporary
()
bool
{
return
ye
.
temporary
}
var
(
// ErrInvalidVersion means we received a frame with an
// invalid version
ErrInvalidVersion
=
&
Yamux
Error
{
msg
:
"invalid protocol version"
}
ErrInvalidVersion
=
&
Error
{
msg
:
"invalid protocol version"
}
// ErrInvalidMsgType means we received a frame with an
// invalid message type
ErrInvalidMsgType
=
&
Yamux
Error
{
msg
:
"invalid msg type"
}
ErrInvalidMsgType
=
&
Error
{
msg
:
"invalid msg type"
}
// ErrSessionShutdown is used if there is a shutdown during
// an operation
ErrSessionShutdown
=
&
Yamux
Error
{
msg
:
"session shutdown"
}
ErrSessionShutdown
=
&
Error
{
msg
:
"session shutdown"
}
// ErrStreamsExhausted is returned if we have no more
// stream ids to issue
ErrStreamsExhausted
=
&
Yamux
Error
{
msg
:
"streams exhausted"
}
ErrStreamsExhausted
=
&
Error
{
msg
:
"streams exhausted"
}
// ErrDuplicateStream is used if a duplicate stream is
// opened inbound
ErrDuplicateStream
=
&
Yamux
Error
{
msg
:
"duplicate stream initiated"
}
ErrDuplicateStream
=
&
Error
{
msg
:
"duplicate stream initiated"
}
// ErrReceiveWindowExceeded indicates the window was exceeded
ErrRecvWindowExceeded
=
&
Yamux
Error
{
msg
:
"recv window exceeded"
}
ErrRecvWindowExceeded
=
&
Error
{
msg
:
"recv window exceeded"
}
// ErrTimeout is used when we reach an IO deadline
ErrTimeout
=
&
Yamux
Error
{
msg
:
"i/o deadline reached"
,
timeout
:
true
,
temporary
:
true
}
ErrTimeout
=
&
Error
{
msg
:
"i/o deadline reached"
,
timeout
:
true
,
temporary
:
true
}
// ErrStreamClosed is returned when using a closed stream
ErrStreamClosed
=
&
Yamux
Error
{
msg
:
"stream closed"
}
ErrStreamClosed
=
&
Error
{
msg
:
"stream closed"
}
// ErrUnexpectedFlag is set when we get an unexpected flag
ErrUnexpectedFlag
=
&
Yamux
Error
{
msg
:
"unexpected flag"
}
ErrUnexpectedFlag
=
&
Error
{
msg
:
"unexpected flag"
}
// ErrRemoteGoAway is used when we get a go away from the other side
ErrRemoteGoAway
=
&
Yamux
Error
{
msg
:
"remote end is not accepting connections"
}
ErrRemoteGoAway
=
&
Error
{
msg
:
"remote end is not accepting connections"
}
// Err
Connection
Reset is sent if a stream is reset. This can happen
// Err
Stream
Reset is sent if a stream is reset. This can happen
// if the backlog is exceeded, or if there was a remote GoAway.
Err
Connection
Reset
=
&
Yamux
Error
{
msg
:
"stream reset"
}
Err
Stream
Reset
=
&
Error
{
msg
:
"stream reset"
}
// ErrConnectionWriteTimeout indicates that we hit the "safety valve"
// timeout writing to the underlying stream connection.
ErrConnectionWriteTimeout
=
&
Yamux
Error
{
msg
:
"connection write timeout"
,
timeout
:
true
}
ErrConnectionWriteTimeout
=
&
Error
{
msg
:
"connection write timeout"
,
timeout
:
true
}
// ErrKeepAliveTimeout is sent if a missed keepalive caused the stream close
ErrKeepAliveTimeout
=
&
Yamux
Error
{
msg
:
"keepalive timeout"
,
timeout
:
true
}
ErrKeepAliveTimeout
=
&
Error
{
msg
:
"keepalive timeout"
,
timeout
:
true
}
)
const
(
...
...
stream.go
View file @
ffc68063
...
...
@@ -91,7 +91,7 @@ START:
return
0
,
io
.
EOF
}
case
streamReset
:
return
0
,
Err
Connection
Reset
return
0
,
Err
Stream
Reset
}
// If there is no data available, block
...
...
@@ -152,7 +152,7 @@ START:
case
streamClosed
:
return
0
,
ErrStreamClosed
case
streamReset
:
return
0
,
Err
Connection
Reset
return
0
,
Err
Stream
Reset
}
// If there is no data available, block
...
...
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