Issue #045 [WontFix/closed] - CoAP server launched even if disabled when using a custom config file

Posted by leo.ricchieri

What steps will reproduce the problem?

  1. Copy /etc/init.d/webiopi on a custom folder
  2. copy /etc/webiopi/config on the same folder as step 1
  3. edit webiopi script that you copied in step 1 and configure it to use config file that you copied on step 2
  4. on config file copied in step 2 disable CoAP server setting enabled to false and disabling also multicasting
  5. on config file configure your personal script in [SCRIPTS] section
  6. if tcp port 8000 is already in use change it to 8081 (just for example)
  7. launch webiopi startup script in your custom folder, python will daemonize, your script will be loaded, your tcp port will be used according your configuration BUT... CoAP server will be launched too even if disabled.

WebIOPi version used? =>0.6.0

Python version used? =>2.7.3

Distro used? (WebIOPi has only been tested on Raspbian Wheezy) =>Raspbian Wheezy

Raspberry Pi board revision? (1 or 2) =>2

For Javascript side bugs, Browser? =>Google Chrome but it's the same

I could disable CoAP changing /etc/webiopi/config but when I tried to use another config file located in my project folder I could set everything I needed but not disabling CoAP server. I could set disabled in the file but when launching the daemon CoAP is launched anyway.


Comment 1

Posted by trouch

I exactly repeated your steps, and did not succeed in reproducing the bug. CoAP server does not bind with another config and daemon script. Config and daemon file used are attached.

check TCP listening socket for python

pi@raspberrypi ~/test $ sudo netstat -antp | grep python

None

check UDP listening socket for python

pi@raspberrypi ~/test $ sudo netstat -anup | grep python

None

see if there is any webiopi running

pi@raspberrypi ~/test $ sudo ps aux | grep webiopi pi 6531 0.0 0.3 3536 804 pts/0 S+ 13:02 0:00 grep --color=auto webiopi

None

start the daemon

pi@raspberrypi ~/test $ sudo ./daemon start

should have 1 TCP listening socket

pi@raspberrypi ~/test $ sudo netstat -antp | grep python tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 6545/python3

should have 0 UDP listening socket

pi@raspberrypi ~/test $ sudo netstat -anup | grep python

check the command line used to launch webiopi

pi@raspberrypi ~/test $ sudo ps aux | grep webiopi root 6545 14.2 5.5 26248 12204 ? Sl 13:02 0:02 /usr/bin/python3 -m webiopi -l /home/pi/test/webiopi.log -c /home/pi/test/config pi 6554 0.0 0.3 3536 804 pts/0 S+ 13:02 0:00 grep --color=auto webiopi

see webiopi log

pi@raspberrypi ~/test $ tail -n 3 webiopi.log
2013-04-06 13:02:18 - WebIOPi - INFO - Loading configuration from /home/pi/test/config 2013-04-06 13:02:18 - WebIOPi - INFO - Access protected using /etc/webiopi/passwd 2013-04-06 13:02:18 - WebIOPi - INFO - HTTP Server binded on http://192.168.1.234:8000/

Files attached


Comment 2

Posted by trouch

also tried with python 2.7, it works too on my side.


Comment 3

Posted by leo.ricchieri

I did some other check, because COAP was launching every time. If I disable my custom script in webiopi.confif in [SCRIPTS] section COAP is not launched, if I add it's launched. Should it be explained because I am using "old stile" server scripting instead of using setup() loop() destroy() ?

porta=8081 server = webiopi.Server(port=porta, login="webiopi", password="raspberry")


Comment 5

Posted by trouch

use webiopi.Server(config="/path/to/config") or webiopi.Server(..., coap_port=None)