File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -155,11 +155,11 @@ func (header *Header) EqualsTo(otherHeader *Header) bool {
155
155
if otherHeader == nil {
156
156
return false
157
157
}
158
- // TLVs only exist for version 2
159
- if header .Version == 2 && ! bytes .Equal (header .rawTLVs , otherHeader .rawTLVs ) {
158
+ if header .Version != otherHeader .Version || header .Command != otherHeader .Command || header .TransportProtocol != otherHeader .TransportProtocol {
160
159
return false
161
160
}
162
- if header .Version != otherHeader .Version || header .Command != otherHeader .Command || header .TransportProtocol != otherHeader .TransportProtocol {
161
+ // TLVs only exist for version 2
162
+ if header .Version == 2 && ! bytes .Equal (header .rawTLVs , otherHeader .rawTLVs ) {
163
163
return false
164
164
}
165
165
// Return early for header with LOCAL command, which contains no address information
Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ func ValidateHeader(v Validator) func(*Conn) {
71
71
}
72
72
}
73
73
74
+ // SetReadHeaderTimeout sets the readHeaderTimeout for a connection when passed as option to NewConn()
75
+ func SetReadHeaderTimeout (t time.Duration ) func (* Conn ) {
76
+ return func (c * Conn ) {
77
+ if t >= 0 {
78
+ c .readHeaderTimeout = t
79
+ }
80
+ }
81
+ }
82
+
74
83
// Accept waits for and returns the next valid connection to the listener.
75
84
func (p * Listener ) Accept () (net.Conn , error ) {
76
85
for {
You can’t perform that action at this time.
0 commit comments