mirror of
git://git.psyced.org/git/pypsyc
synced 2024-08-15 03:20:04 +00:00
last state we had in cvs
This commit is contained in:
commit
0f02e9cd76
128 changed files with 9224 additions and 0 deletions
0
mjacob/socket_/__init__.py
Normal file
0
mjacob/socket_/__init__.py
Normal file
BIN
mjacob/socket_/__init__.pyc
Normal file
BIN
mjacob/socket_/__init__.pyc
Normal file
Binary file not shown.
46
mjacob/socket_/twisted_.py
Executable file
46
mjacob/socket_/twisted_.py
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from twisted.internet import protocol
|
||||
|
||||
from base import MMPCircuit, PSYCCircuit
|
||||
from client import ClientCenter
|
||||
from server import ServerCenter
|
||||
|
||||
|
||||
class CircuitBaseProtocol(protocol.Protocol):
|
||||
def connectionMade(self):
|
||||
self.init()
|
||||
|
||||
def dataReceived(self, data):
|
||||
self.mmp_parser.data(data)
|
||||
|
||||
def _send(self, data):
|
||||
print (data,)
|
||||
self.transport.write(data)
|
||||
|
||||
|
||||
class MMPCircuitProtocol(CircuitBaseProtocol, MMPCircuit): pass
|
||||
|
||||
|
||||
class PSYCCircuitProtocol(CircuitBaseProtocol, PSYCCircuit): pass
|
||||
|
||||
|
||||
class TwistedClientCenter(ClientCenter, protocol.ClientFactory):
|
||||
def buildProtocol(self, addr):
|
||||
p = PSYCCircuitProtocol(self)
|
||||
self.connected(p, addr.host)
|
||||
return p
|
||||
|
||||
def connect(self, host, port = 4404):
|
||||
self.reactor.connectTCP(host, port, self)
|
||||
|
||||
|
||||
#class TwistedServerCenter(ClientCenter, protocol.ClientFactory):
|
||||
# def buildProtocol(self, addr):
|
||||
# p = CircuitProtocol(self)
|
||||
# self.connected(p, addr.host)
|
||||
# return p
|
||||
#
|
||||
# def connect(self, host, port = 4404):
|
||||
# self.reactor.connectTCP(host, port, self)
|
BIN
mjacob/socket_/twisted_.pyc
Normal file
BIN
mjacob/socket_/twisted_.pyc
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue