HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.37k stars 2.27k forks source link

CLI siteDownload doesn't work, expects privileged port, ConnServer hangs? #1468

Closed vitorio closed 6 years ago

vitorio commented 6 years ago

Step 1: Please describe your environment

Step 2: Describe the problem:

I'm trying to set up a permanent peer for my site, but the siteDownload CLI option does not appear to work, and a siteAdd command as suggested in IRC does not appear to exist.

Steps to reproduce:

  1. Install on Debian using either the "manual install" directions, the "virtualenv" directions, or the "bundle" directions (I've tried all three)
  2. python ./zeronet.py siteDownload [myaddress]

Observed Results:

- Starting ZeroNet...
- OpenSSL loaded, version: 0100020CF
- Version: 0.6.3 r3501, Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516], Gevent: 1.3.4
- Opening a simple connection server
TorManager Connecting to Tor Controller 127.0.0.1:9051
TorManager Starting self-bundled Tor, due to Tor proxy port 127.0.0.1:9050 check error: No connection
ConnServer Checking port 1234 using portchecker.co...
ConnServer [BAD :(] Port closed: Port 1234 is closed.
ConnServer Trying to open port using UpnpPunch...
ConnServer Internet offline

It just sits there at this point, until I eventually hit Ctrl-C.

^CShutting down...
- Unhandled exception
None
KeyboardInterrupt
Announcing...
Downloading...
True
Downloaded in 5.445s

Expected Results:

I expected it to start up properly and host my site.

When running python ./zeronet.py with no parameters, the startup looks like this:

- Starting ZeroNet...
[23:13:06] - OpenSSL loaded, version: 0100020CF
[23:13:06] - Version: 0.6.3 r3501, Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516], Gevent: 1.1.2
[23:13:06] - Creating FileServer....
[23:13:06] - Creating UiServer....
[23:13:06] - Removing old SSL certs...
[23:13:06] - Starting servers....
[23:13:06] Ui.UiServer --------------------------------------
[23:13:06] Ui.UiServer Web interface: http://127.0.0.1:43110/
[23:13:06] Ui.UiServer --------------------------------------
[23:13:06] TorManager Connecting to Tor Controller 127.0.0.1:9051
[23:13:06] TorManager Starting self-bundled Tor, due to Tor proxy port 127.0.0.1:9050 check error: No connection
[23:13:07] ConnServer Checking port 27297 using portchecker.co...
[23:13:07] ConnServer [OK :)] Port open: Port 27297 is open.

(As this is a remote server, I'm not interested in exposing the web interface just to host a site.)

The difference appears to be in part that in src/main.py, the "siteDownload" command hardcodes a local address and privileged port, and the "main" command does not:

main(): file_server = FileServer()

siteDownload(): file_server = FileServer("127.0.0.1", 1234)

Removing the parameters from siteDownload makes the output look like this:

- Starting ZeroNet...
- OpenSSL loaded, version: 0100020CF
- Version: 0.6.3 r3501, Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516], Gevent: 1.3.4
- Opening a simple connection server
TorManager Connecting to Tor Controller 127.0.0.1:9051
TorManager Starting self-bundled Tor, due to Tor proxy port 127.0.0.1:9050 check error: No connection
ConnServer Checking port 27297 using portchecker.co...
ConnServer [OK :)] Port open: Port 27297 is open.

But it still never displays "Announcing", "Downloading" or "Downloaded" until I hit Ctrl-C:

^CShutting down...
- Unhandled exception
None
KeyboardInterrupt
Announcing...
Downloading...
True
Downloaded in 5.548s

So there's additional issues somewhere else.

HelloZeroNet commented 6 years ago

Thanks for reporting, it's fixed in Rev3502: https://github.com/HelloZeroNet/ZeroNet/commit/ec05e6864ab918794df12ea140f1da7c48e1d1fe (file_server.start was changed from async to be sync command some weeks ago)

vitorio commented 6 years ago

Seems to work now, thanks!