示例#1
0
文件: Luciana.py 项目: safvan010/123
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
# for the specific language governing rights and limitations under the
# License.
#
# by Greg Hazel

from twisted.internet import iocpreactor
iocpreactor.proactor.install()

from twisted.internet.selectreactor import SelectReactor
selectreactor = SelectReactor()

from twisted.internet import reactor

selectreactor.spin_task = 0


def selectrun():
    selectreactor.iterate(0)
    if selectreactor.spin_task > 0:
        reactor.callLater(0.01, selectrun)


class HookedFactory(object):
    def __init__(self, factory):
        self.factory = factory

    def startedConnecting(self, connector):
        if selectreactor.spin_task == 0:
            reactor.callLater(0.01, selectrun)
示例#2
0
# for the specific language governing rights and limitations under the
# License.
#
# by Greg Hazel

from twisted.internet import iocpreactor

iocpreactor.proactor.install()

from twisted.internet.selectreactor import SelectReactor

selectreactor = SelectReactor()

from twisted.internet import reactor

selectreactor.spin_task = 0


def selectrun():
    selectreactor.iterate(0)
    if selectreactor.spin_task > 0:
        reactor.callLater(0.01, selectrun)


class HookedFactory(object):
    def __init__(self, factory):
        self.factory = factory

    def startedConnecting(self, connector):
        if selectreactor.spin_task == 0:
            reactor.callLater(0.01, selectrun)