Skip to content

Commit

Permalink
Add fallback for users who ran master with the old default config
Browse files Browse the repository at this point in the history
  • Loading branch information
Maran committed Oct 9, 2012
1 parent a27fba8 commit 8833555
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from version import ELECTRUM_VERSION
from util import print_error
from simple_config import SimpleConfig

DEFAULT_TIMEOUT = 5
DEFAULT_SERVERS = [ 'electrum.novit.ro:50001:t',
Expand Down Expand Up @@ -189,9 +190,17 @@ def send(self, messages):
import urllib2, json, time, cookielib

if self.proxy:
# This is a friendly fallback to the old style default proxy options
if(self.proxy["mode"] == "none"):
simple_config = SimpleConfig()
simple_config.set_key("proxy", None, True)
return

import socks

socks.setdefaultproxy(proxy_modes.index(self.proxy["mode"]), self.proxy["host"], int(self.proxy["port"]) )
socks.wrapmodule(urllib2)

cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
Expand Down

2 comments on commit 8833555

@ecdsa
Copy link
Member

@ecdsa ecdsa commented on 8833555 Oct 10, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check is supposed to be performed only once, I don't think that it should be in the 'send' method.

@maran
Copy link
Contributor

@maran maran commented on 8833555 Oct 10, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, I will try to find a better entry point for it.

Please sign in to comment.