mirror of
https://github.com/Dinnerbone/mcstatus.git
synced 2026-04-06 20:11:24 +08:00
Use bytearray more efficiently, better python 3.1 support
This commit is contained in:
@@ -15,10 +15,14 @@ class Connection:
|
||||
return result
|
||||
|
||||
def write(self, data):
|
||||
self.sent += data
|
||||
if not isinstance(data, bytearray):
|
||||
data = bytearray(data)
|
||||
self.sent.extend(data)
|
||||
|
||||
def receive(self, data):
|
||||
self.received += data
|
||||
if not isinstance(data, bytearray):
|
||||
data = bytearray(data)
|
||||
self.received.extend(data)
|
||||
|
||||
def remaining(self):
|
||||
return len(self.received)
|
||||
|
||||
Reference in New Issue
Block a user