Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
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
uva
Commits
96d89030
Commit
96d89030
authored
Mar 10, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added proper connection error handling.
parent
692d3737
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
telematica/ass1/async.py
telematica/ass1/async.py
+6
-0
telematica/ass1/base_bar.py
telematica/ass1/base_bar.py
+3
-3
telematica/ass1/cli.py
telematica/ass1/cli.py
+2
-0
No files found.
telematica/ass1/async.py
View file @
96d89030
...
@@ -51,6 +51,12 @@ class ClientConnection(object, AsyncBase, asyncore.dispatcher):
...
@@ -51,6 +51,12 @@ class ClientConnection(object, AsyncBase, asyncore.dispatcher):
if
'connect'
in
self
.
event_list
:
if
'connect'
in
self
.
event_list
:
self
.
event_list
[
'connect'
](
self
)
self
.
event_list
[
'connect'
](
self
)
def
handle_error
(
self
):
if
hasattr
(
self
,
'main'
):
self
.
main
.
execute
(
'disconnect'
)
self
.
main
.
display_info
(
'Error raised due to a broken or refused'
\
+
' connection'
)
def
handle_close
(
self
):
def
handle_close
(
self
):
self
.
close
()
self
.
close
()
...
...
telematica/ass1/base_bar.py
View file @
96d89030
...
@@ -16,15 +16,15 @@ class BaseBar(object):
...
@@ -16,15 +16,15 @@ class BaseBar(object):
self
.
color_pair
=
curses
.
color_pair
(
0
)
self
.
color_pair
=
curses
.
color_pair
(
0
)
self
.
_prefix
=
''
self
.
_prefix
=
''
def
prefix
(
self
,
value
=
''
):
def
prefix
(
self
,
value
=
None
):
if
not
value
:
if
value
==
None
:
# Note: an empty string can also be set.
return
self
.
_prefix
return
self
.
_prefix
self
.
_prefix
=
value
self
.
_prefix
=
value
self
.
display
(
self
.
_msg
)
self
.
display
(
self
.
_msg
)
def
display
(
self
,
msg
):
def
display
(
self
,
msg
):
self
.
_msg
=
msg
self
.
_msg
=
msg
if
self
.
prefix
:
if
self
.
prefix
()
:
msg
=
self
.
prefix
()
+
' '
+
msg
msg
=
self
.
prefix
()
+
' '
+
msg
# Curses will raise a 'curses.error' when the last possible character is
# Curses will raise a 'curses.error' when the last possible character is
# written. This exception should therefore always be catched. The raised
# written. This exception should therefore always be catched. The raised
...
...
telematica/ass1/cli.py
View file @
96d89030
...
@@ -158,7 +158,9 @@ class CLI:
...
@@ -158,7 +158,9 @@ class CLI:
self
.
connection
=
None
self
.
connection
=
None
self
.
display_info
(
'Offline. Type "/connect HOST" to connect'
\
self
.
display_info
(
'Offline. Type "/connect HOST" to connect'
\
+
' to another chat server.'
)
+
' to another chat server.'
)
self
.
info_bar
.
prefix
(
''
)
self
.
debug_window
.
clear
()
self
.
debug_window
.
clear
()
self
.
refresh
()
def
help
(
main
):
def
help
(
main
):
if
main
.
chat_window
.
displayed_help
:
if
main
.
chat_window
.
displayed_help
:
...
...
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