mein client crashed wenn ich auf status tab klicke
Verfasst: Samstag 5. November 2005, 20:33
hi
habe in mein SamServer.py die function
eingefügt damit es wenn man auf status tab klickt oder auf doppel klick nicht abstürzt.
aber es geht nicht wie ich es gedacht hatte!
so nun wenn ich im meinem client auf das status tab klicke und dabei noch das torent das grad aktive ist bricht die verbindung ab also downloads usw geht nicht mehr.!
Ich muss dann stoppen und von neustarten!
hier das exe.log:
ich habe ja get_address in mein SamServer.py intregriert habe gedacht das nun der crash nicht mehr auftaucht!
aber trotzdem nun in Connecter.py un Encrypter.py
hier Connector.py:
hier Encrypter.py:
get_adress existiert jedenfalls im SamServer.py
habe in mein SamServer.py die function
Code: Alles auswählen
def get_address(self):
return self.dest
aber es geht nicht wie ich es gedacht hatte!
Code: Alles auswählen
from bisect import insort
import select, socket
import string
from cStringIO import StringIO
from traceback import print_exc, print_stack
from errno import EINTR, EWOULDBLOCK
from time import time, sleep
from random import randrange
import sys
import Logger
import SamBuffer
class SingleSocket:
def __init__(self, raw_server, sock, handler, logger):
self.raw_server = raw_server
# sock is (id, dest)
self.id = sock[0]
self.dest = sock[1]
self.handler = handler
self.logger = logger
self.buffer = StringIO()
self.last_hit = time()
self.connected = False
def connect(self):
self.connected = True
def close(self):
"""Initiate socket closing."""
self.raw_server.logger.debug("Sending close to %d", self.id)
# uncomment to dump the stack to the logs
#data = StringIO()
#print_stack(file = data)
#self.raw_server.logger.debug(data.getvalue())
self.raw_server._sendClose(self.id)
def get_ip(self):
return self.dest
def get_address(self):
return self.dest
Ich muss dann stoppen und von neustarten!
hier das exe.log:
File "btsession.pyo", line 883, in Download_Thread
File "BitTorrent\download.pyo", line 456, in download
File "BitTorrent\SamServer.pyo", line 376, in listen_forever
File "BitTorrent\DownloaderFeedback.pyo", line 152, in display
File "BitTorrent\DownloaderFeedback.pyo", line 51, in collect_spew
ValueError: too many values to unpack
die get_address dinge versursachen crash!File "btsession.pyo", line 883, in Download_Thread
File "BitTorrent\download.pyo", line 456, in download
File "BitTorrent\SamServer.pyo", line 373, in listen_forever
File "BitTorrent\DownloaderFeedback.pyo", line 152, in display
File "BitTorrent\DownloaderFeedback.pyo", line 51, in collect_spew
File "BitTorrent\Connecter.pyo", line 50, in get_address
File "BitTorrent\Encrypter.pyo", line 44, in get_address
AttributeError: SingleSocket instance has no attribute 'get_address'
ich habe ja get_address in mein SamServer.py intregriert habe gedacht das nun der crash nicht mehr auftaucht!
aber trotzdem nun in Connecter.py un Encrypter.py
hier Connector.py:
Code: Alles auswählen
# Written by Bram Cohen
# see LICENSE.txt for license information
from bitfield import Bitfield
from binascii import b2a_hex
from CurrentRateMeasure import Measure
def toint(s):
return long(b2a_hex(s), 16)
def tobinary(i):
return (chr(i >> 24) + chr((i >> 16) & 0xFF) +
chr((i >> 8) & 0xFF) + chr(i & 0xFF))
CHOKE = chr(0)
UNCHOKE = chr(1)
INTERESTED = chr(2)
NOT_INTERESTED = chr(3)
# index
HAVE = chr(4)
# index, bitfield
BITFIELD = chr(5)
# index, begin, length
REQUEST = chr(6)
# index, begin, piece
PIECE = chr(7)
# index, begin, piece
CANCEL = chr(8)
class Connection:
def __init__(self, connection, connecter):
self.connection = connection
self.connecter = connecter
self.got_anything = False
self.have = None
self.last_msg_out = ''
self.last_msg_in = ''
#g3rmz
def get_time_connected(self):
return self.connection.time_connected
def get_last_send(self):
return self.last_msg_out
def get_last_recv(self):
return self.last_msg_in
def get_address(self):
return self.connection.get_address()
Code: Alles auswählen
from cStringIO import StringIO
from binascii import b2a_hex
from socket import error as socketerror
import time
#I2P
from traceback import print_exc, print_stack
#/I2P
protocol_name = 'BitTorrent protocol'
def toint(s):
return long(b2a_hex(s), 16)
def tobinary(i):
return (chr(i >> 24) + chr((i >> 16) & 0xFF) +
chr((i >> 8) & 0xFF) + chr(i & 0xFF))
# header, reserved, download id, my id, [length, message]
class Connection:
def __init__(self, Encoder, connection, id, is_local):
self.encoder = Encoder
self.connection = connection
self.id = id
self.locally_initiated = is_local
self.complete = False
self.closed = False
self.buffer = StringIO()
self.next_len = 1
self.next_func = self.read_header_len
self.time_connected = time.time()
if self.locally_initiated:
connection.write(chr(len(protocol_name)) + protocol_name +
(chr(0) * 8) + self.encoder.download_id)
if self.id is not None:
connection.write(self.encoder.my_id)
#g3rmz
def get_address(self):
return self.connection.get_address()