projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto: Remove dummy 'in_port' variable.
[openvswitch]
/
python
/
ovs
/
stream.py
diff --git
a/python/ovs/stream.py
b/python/ovs/stream.py
index c1ce422fa43ca71a518a6272b93bdc327780ff95..35f2e0ce7f960ea430eb7ae7a47c18212a1eb5d7 100644
(file)
--- a/
python/ovs/stream.py
+++ b/
python/ovs/stream.py
@@
-1,4
+1,4
@@
-# Copyright (c) 2010 Nicira Networks
+# Copyright (c) 2010
, 2011
Nicira Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@
-17,7
+17,6
@@
import logging
import os
import select
import socket
import os
import select
import socket
-import sys
import ovs.poller
import ovs.socket_util
import ovs.poller
import ovs.socket_util
@@
-75,8
+74,8
@@
class Stream(object):
return errno.EAFNOSUPPORT, None
Stream.n_unix_sockets += 1
return errno.EAFNOSUPPORT, None
Stream.n_unix_sockets += 1
- bind_path = "/tmp/stream-unix.%
l
d.%d" % (os.getpid(),
-
Stream.n_unix_sockets)
+ bind_path = "/tmp/stream-unix.%d.%d" % (os.getpid(),
+ Stream.n_unix_sockets)
connect_path = name[5:]
error, sock = ovs.socket_util.make_unix_socket(socket.SOCK_STREAM,
True, bind_path,
connect_path = name[5:]
error, sock = ovs.socket_util.make_unix_socket(socket.SOCK_STREAM,
True, bind_path,
@@
-88,15
+87,14
@@
class Stream(object):
return 0, Stream(sock, name, bind_path, status)
@staticmethod
return 0, Stream(sock, name, bind_path, status)
@staticmethod
- def open_block(
tuple
):
+ def open_block(
(error, stream)
):
"""Blocks until a Stream completes its connection attempt, either
"""Blocks until a Stream completes its connection attempt, either
- succeeding or failing.
'tuple'
should be the tuple returned by
+ succeeding or failing.
(error, stream)
should be the tuple returned by
Stream.open(). Returns a tuple of the same form.
Typical usage:
Stream.open(). Returns a tuple of the same form.
Typical usage:
- error, stream = Stream.open_block(Stream.open("
tcp:1.2.3.4:5
"))"""
+ error, stream = Stream.open_block(Stream.open("
unix:/tmp/socket
"))"""
- error, stream = tuple
if not error:
while True:
error = stream.connect()
if not error:
while True:
error = stream.connect()
@@
-207,10
+205,10
@@
class Stream(object):
if self.state == Stream.__S_CONNECTING:
wait = Stream.W_CONNECT
if self.state == Stream.__S_CONNECTING:
wait = Stream.W_CONNECT
- if wait in (Stream.W_CONNECT, Stream.W_SEND):
- poller.fd_wait(self.socket, select.POLLOUT)
- else:
+ if wait == Stream.W_RECV:
poller.fd_wait(self.socket, select.POLLIN)
poller.fd_wait(self.socket, select.POLLIN)
+ else:
+ poller.fd_wait(self.socket, select.POLLOUT)
def connect_wait(self, poller):
self.wait(poller, Stream.W_CONNECT)
def connect_wait(self, poller):
self.wait(poller, Stream.W_CONNECT)
@@
-221,9
+219,6
@@
class Stream(object):
def send_wait(self, poller):
self.wait(poller, Stream.W_SEND)
def send_wait(self, poller):
self.wait(poller, Stream.W_SEND)
- def get_name(self):
- return self.name
-
def __del__(self):
# Don't delete the file: we might have forked.
self.socket.close()
def __del__(self):
# Don't delete the file: we might have forked.
self.socket.close()
@@
-304,7
+299,7
@@
class PassiveStream(object):
# Don't delete the file: we might have forked.
self.socket.close()
# Don't delete the file: we might have forked.
self.socket.close()
-def usage(name, active, passive
, bootstrap
):
+def usage(name, active, passive):
print
if active:
print("Active %s connection methods:" % name)
print
if active:
print("Active %s connection methods:" % name)