Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iliya Manolov
neoppod
Commits
fe487c07
Commit
fe487c07
authored
Nov 27, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ssl: fix handshaking connections being stuck when they're aborted
parent
aaefaf8b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
5 deletions
+35
-5
neo/lib/connection.py
neo/lib/connection.py
+4
-1
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+3
-3
neo/tests/threaded/testSSL.py
neo/tests/threaded/testSSL.py
+28
-1
No files found.
neo/lib/connection.py
View file @
fe487c07
...
...
@@ -433,9 +433,12 @@ class Connection(BaseConnection):
def
abort
(
self
):
"""Abort dealing with this connection."""
assert
self
.
pending
()
if
self
.
connecting
:
self
.
close
()
return
logging
.
debug
(
'aborting a connector for %r'
,
self
)
self
.
aborted
=
True
assert
self
.
pending
()
if
self
.
_on_close
is
not
None
:
self
.
_on_close
()
self
.
_on_close
=
None
...
...
neo/tests/threaded/__init__.py
View file @
fe487c07
...
...
@@ -278,8 +278,8 @@ class ServerNode(Node):
if
not
address
:
address
=
self
.
newAddress
()
if
cluster
is
None
:
master_nodes
=
kw
[
'master_nodes'
]
name
=
kw
[
'name'
]
master_nodes
=
kw
.
get
(
'master_nodes'
,
())
name
=
kw
.
get
(
'name'
,
'test'
)
else
:
master_nodes
=
kw
.
get
(
'master_nodes'
,
cluster
.
master_nodes
)
name
=
kw
.
get
(
'name'
,
cluster
.
name
)
...
...
@@ -292,7 +292,7 @@ class ServerNode(Node):
self
.
daemon
=
True
self
.
node_name
=
'%s_%u'
%
(
self
.
node_type
,
port
)
kw
.
update
(
getCluster
=
name
,
getBind
=
address
,
getMasters
=
parseMasterList
(
master_nodes
,
address
))
getMasters
=
master_nodes
and
parseMasterList
(
master_nodes
,
address
))
super
(
ServerNode
,
self
).
__init__
(
Mock
(
kw
))
def
getVirtualAddress
(
self
):
...
...
neo/tests/threaded/testSSL.py
View file @
fe487c07
...
...
@@ -15,8 +15,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
unittest
from
neo.lib.connection
import
ClientConnection
,
ListeningConnection
from
neo.lib.handler
import
EventHandler
from
neo.lib.protocol
import
Packets
from
..
import
SSL
from
.
import
NEOCluster
,
test
,
testReplication
from
.
import
MasterApplication
,
NEOCluster
,
test
,
testReplication
class
SSLMixin
:
...
...
@@ -34,6 +37,30 @@ class SSLTests(SSLMixin, test.Test):
# exclude expected failures
testDeadlockAvoidance
=
testStorageFailureDuringTpcFinish
=
None
def
testAbortConnection
(
self
):
app
=
MasterApplication
(
getSSL
=
SSL
,
getReplicas
=
0
,
getPartitions
=
1
)
handler
=
EventHandler
(
app
)
app
.
listening_conn
=
ListeningConnection
(
app
,
handler
,
app
.
server
)
node
=
app
.
nm
.
createMaster
(
address
=
app
.
listening_conn
.
getAddress
(),
uuid
=
app
.
uuid
)
for
after_handshake
in
1
,
0
:
conn
=
ClientConnection
(
app
,
handler
,
node
)
conn
.
ask
(
Packets
.
Ping
())
connector
=
conn
.
getConnector
()
del
connector
.
connect_limit
[
connector
.
addr
]
app
.
em
.
poll
(
1
)
self
.
assertTrue
(
isinstance
(
connector
,
connector
.
SSLHandshakeConnectorClass
))
self
.
assertNotIn
(
connector
.
getDescriptor
(),
app
.
em
.
writer_set
)
if
after_handshake
:
while
not
isinstance
(
connector
,
connector
.
SSLConnectorClass
):
app
.
em
.
poll
(
1
)
conn
.
abort
()
fd
=
connector
.
getDescriptor
()
while
fd
in
app
.
em
.
reader_set
:
app
.
em
.
poll
(
1
)
self
.
assertIs
(
conn
.
getConnector
(),
None
)
class
SSLReplicationTests
(
SSLMixin
,
testReplication
.
ReplicationTests
):
# do not repeat slowest tests with SSL
testBackupNodeLost
=
testBackupNormalCase
=
None
...
...
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