-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
30 changed files
with
847 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
*.py[cod] | ||
MANIFEST | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
# general things to ignore | ||
build/ | ||
dist/ | ||
*.egg-info/ | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib | ||
lib64 | ||
__pycache__ | ||
|
||
# Installer logs | ||
pip-log.txt | ||
*.py[cod] | ||
__pycache__/ | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
# tox | ||
.tox | ||
nosetests.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# docs/sphinx | ||
/docs/_build/ | ||
|
||
# emacs backup files | ||
*~ | ||
# docutil generated | ||
/README.html | ||
/CHANGELOG.html | ||
/TODO.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Changelog | ||
========= | ||
|
||
v0.9.0 (2016-01-04) | ||
------------------- | ||
|
||
No major new features, API cleanup to ensure that connections are | ||
properly closed. Functions that return binary data return ``bytes``. | ||
|
||
* implement dummy context management protocol for ``_Proxy`` | ||
for consitency with _PersistentProxy | ||
* ``OwnetProxy`` class deprecated | ||
* create a diagnostics directory ``./diags`` | ||
* move test suite from ``./test`` to ``./tests`` | ||
* ``pyownet.protocol._OwnetConnection.req()`` returns ``bytes`` and not | ||
``bytearray`` | ||
|
||
This is due to a simplification in | ||
``pyownet.protocol._OwnetConnection._read_socket()`` method. | ||
* better connection logic in ``pyownet.protocol.proxy()`` factory: | ||
first connect or raise ``protocol.ConnError``, | ||
then test owserver protocol or raise ``protocol.ProtocolError`` | ||
* use relative imports in ``pyownet.protocol`` | ||
* ``./test`` and ``./examples`` minor code refactor | ||
* ``.gitignore`` cleanup (use only project specific ignores) | ||
* add ``__del__`` in ``_PersistentProxy`` to ensure connection is closed | ||
* use ``with _OwnetConnection`` inside ``_Proxy`` to shutdown sockets | ||
* implement context management protocol for ``_OwnetConnection`` to | ||
guarantee that connection is shutdown on exit | ||
* py26 testing via ``unittest2`` | ||
* transform ``./test`` directory in package, so that common code | ||
(used for reading configuration files) can be shared more easily | ||
* move ``./pyownet`` to ``./src/pyownet`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include *.rst LICENSE.txt | ||
recursive-include test __init__.py test*.py tests.ini | ||
include README.rst CHANGELOG.rst LICENSE.txt | ||
recursive-include tests __init__.py test*.py tests.ini | ||
recursive-include examples *.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
TODO | ||
==== | ||
|
||
* Document that every pathname had to by an ASCIIZ string on the wire | ||
in older owlib versions. | ||
|
||
* ``FLG_ALIAS`` is apparently not working as expected. | ||
|
||
* In the reply to a ``MSG_DIR`` message it seems that the offset field | ||
has the pourpose of coding some info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A collection of (yet) undocumented diagnostic tools. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# script to test bug #1 | ||
# | ||
import sys | ||
|
||
if sys.version_info < (3, ): | ||
from urlparse import (urlsplit, ) | ||
else: | ||
from urllib.parse import (urlsplit, ) | ||
|
||
from pyownet.protocol import proxy | ||
|
||
|
||
def main(): | ||
assert len(sys.argv) == 2 | ||
urlc = urlsplit(sys.argv[1], scheme='owserver', allow_fragments=False) | ||
host = urlc.hostname or 'localhost' | ||
port = urlc.port or 4304 | ||
path = urlc.path or '/' | ||
|
||
p = proxy(host, port, verbose=True) | ||
|
||
while True: | ||
ret = p.read(path) | ||
assert ret, "'%s'" % ret | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""floods owserver with non persistent requests | ||
This program floods the owserver with non persistent dir() requests. | ||
After about 16384 requests should fail with | ||
'[Errno 49] Can't assign requested address' | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
import itertools | ||
import sys | ||
if sys.version_info < (3, ): | ||
from urlparse import (urlsplit, ) | ||
else: | ||
from urllib.parse import (urlsplit, ) | ||
|
||
import pyownet | ||
from pyownet import protocol | ||
|
||
|
||
def main(): | ||
assert len(sys.argv) == 2 | ||
urlc = urlsplit(sys.argv[1], scheme='owserver', allow_fragments=False) | ||
host = urlc.hostname or 'localhost' | ||
port = urlc.port or 4304 | ||
assert not urlc.path or urlc.path == '/' | ||
|
||
p = protocol.proxy(host, port, persistent=False) | ||
pid = 'unknown' | ||
ver = 'unknown' | ||
try: | ||
pid = int(p.read('/system/process/pid')) | ||
ver = p.read('/system/configuration/version').decode() | ||
except protocol.OwnetError: | ||
pass | ||
print(pyownet.__name__, pyownet.__version__, pyownet.__file__) | ||
print('proxy_obj: {}'.format(p)) | ||
print('server info: pid {}, ver. {}'.format(pid, ver)) | ||
|
||
freq = 1 << 12 | ||
|
||
for i in itertools.count(): | ||
try: | ||
_ = p.dir() | ||
except protocol.Error as exc: | ||
print('Iteration {0} raised exception: {1}'.format(i, exc)) | ||
break | ||
None if i % freq else print('Iteration {}'.format(i)) | ||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.