Browse Source
interface: make changing max incoming msg size (1 MB) easier
hard-fail-on-bad-server-string
SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
7 additions and
1 deletions
-
electrum/interface.py
|
|
@ -36,7 +36,7 @@ import itertools |
|
|
|
import logging |
|
|
|
|
|
|
|
import aiorpcx |
|
|
|
from aiorpcx import RPCSession, Notification, NetAddress |
|
|
|
from aiorpcx import RPCSession, Notification, NetAddress, NewlineFramer |
|
|
|
from aiorpcx.curio import timeout_after, TaskTimeout |
|
|
|
from aiorpcx.jsonrpc import JSONRPC, CodeMessageError |
|
|
|
from aiorpcx.rawsocket import RSClient |
|
|
@ -62,6 +62,8 @@ ca_path = certifi.where() |
|
|
|
|
|
|
|
BUCKET_NAME_OF_ONION_SERVERS = 'onion' |
|
|
|
|
|
|
|
MAX_INCOMING_MSG_SIZE = 1_000_000 # in bytes |
|
|
|
|
|
|
|
|
|
|
|
class NetworkTimeout: |
|
|
|
# seconds |
|
|
@ -157,6 +159,10 @@ class NotificationSession(RPCSession): |
|
|
|
if self.interface.debug or self.interface.network.debug: |
|
|
|
self.interface.logger.debug(msg) |
|
|
|
|
|
|
|
def default_framer(self): |
|
|
|
# overridden so that max_size can be customized |
|
|
|
return NewlineFramer(max_size=MAX_INCOMING_MSG_SIZE) |
|
|
|
|
|
|
|
|
|
|
|
class NetworkException(Exception): pass |
|
|
|
|
|
|
|