Show More
@@ -153,13 +153,9 b' class HttpHooksCallbackDaemon(ThreadedHo' | |||||
153 | # request and wastes cpu at all other times. |
|
153 | # request and wastes cpu at all other times. | |
154 | POLL_INTERVAL = 0.01 |
|
154 | POLL_INTERVAL = 0.01 | |
155 |
|
155 | |||
156 | def get_available_port(): |
|
156 | def get_available_port(self): | |
157 | family = socket.AF_INET |
|
157 | mysocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
158 | socktype = socket.SOCK_STREAM |
|
158 | mysocket.bind(('127.0.0.1', 0)) | |
159 | host = '127.0.0.1' |
|
|||
160 |
|
||||
161 | mysocket = socket.socket(family, socktype) |
|
|||
162 | mysocket.bind((host, 0)) |
|
|||
163 | port = mysocket.getsockname()[1] |
|
159 | port = mysocket.getsockname()[1] | |
164 | mysocket.close() |
|
160 | mysocket.close() | |
165 | del mysocket |
|
161 | del mysocket |
General Comments 0
You need to be logged in to leave comments.
Login now