Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wspy-multiplex
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
wspy-multiplex
Commits
9ce84ce0
Commit
9ce84ce0
authored
Aug 22, 2013
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed number picking such that a new chosen number is as small as possible
parent
e23ed990
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
connection.py
connection.py
+10
-4
No files found.
connection.py
View file @
9ce84ce0
...
...
@@ -7,7 +7,6 @@ from twspy import Connection
class
Multiplexer
(
object
):
def
__init__
(
self
,
sock
):
self
.
channels
=
[]
self
.
number
=
0
self
.
conn
=
MuxConnection
(
sock
)
def
__str__
(
self
):
...
...
@@ -21,9 +20,16 @@ class Multiplexer(object):
return
'closed connection'
def
add_channel
(
self
,
channel
):
self
.
channels
.
append
(
channel
)
self
.
number
+=
1
return
self
.
number
numbers
=
sorted
(
self
.
channels
)
number
=
numbers
[
-
1
]
+
1
is
len
(
numbers
)
else
1
for
i
,
nr
in
enumerate
(
numbers
):
if
self
.
channels
[
i
+
1
]
>
nr
:
number
=
nr
+
1
break
self
.
channels
[
number
]
=
channel
return
number
def
send
(
self
,
message
,
channel
):
raise
NotImplementedError
...
...
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