Project

Profile

Help

Revision c377606f

Added by Vincent Le Goff over 4 years ago

Mainly fix #67: when a message can't be sent, attempt to reconnect to the server

View differences:

src/client.py
34 34

  
35 35
import os
36 36
import re
37
import socket
37 38
from telnetlib import Telnet, WONT, WILL, ECHO, NOP, AYT, IAC
38 39
import threading
39 40
import time
......
93 94

  
94 95
            try:
95 96
                msg = self.client.read_very_eager()
97
            except socket.error:
98
                if self.window:
99
                    self.window.handle_reconnection()
96 100
            except EOFError:
97 101
                break
98 102

  
src/ui/window.py
467 467

  
468 468
    def __init__(self, parent, window, engine, world, session):
469 469
        self.rich = engine.settings["options.output.richtext"]
470
        print "Create a world with rich", self.rich
471 470
        AccessPanel.__init__(self, parent, history=True, lock_input=True,
472 471
                ansi=self.rich, rich=self.rich)
473 472
        if self.rich:
......
540 539
        self.Send(message)
541 540
        ScreenReader.talk(message, interrupt=False)
542 541

  
542
    def handle_reconnection(self):
543
        """Attempts to reconnect."""
544
        self.CreateClient()
545

  
543 546
    def handle_message(self, message, mark=None):
544 547
        """The client has just received a message."""
545 548
        point = self.editing_pos

Also available in: Unified diff