Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Side by Side Diff: Lib/asyncore.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/ast.py ('k') | Lib/binhex.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- Mode: Python -*- 1 # -*- Mode: Python -*-
2 # Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp 2 # Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp
3 # Author: Sam Rushing <rushing@nightmare.com> 3 # Author: Sam Rushing <rushing@nightmare.com>
4 4
5 # ====================================================================== 5 # ======================================================================
6 # Copyright 1996 by Sam Rushing 6 # Copyright 1996 by Sam Rushing
7 # 7 #
8 # All Rights Reserved 8 # All Rights Reserved
9 # 9 #
10 # Permission to use, copy, modify, and distribute this software and 10 # Permission to use, copy, modify, and distribute this software and
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 def poll(timeout=0.0, map=None): 125 def poll(timeout=0.0, map=None):
126 if map is None: 126 if map is None:
127 map = socket_map 127 map = socket_map
128 if map: 128 if map:
129 r = []; w = []; e = [] 129 r = []; w = []; e = []
130 for fd, obj in list(map.items()): 130 for fd, obj in list(map.items()):
131 is_r = obj.readable() 131 is_r = obj.readable()
132 is_w = obj.writable() 132 is_w = obj.writable()
133 if is_r: 133 if is_r:
134 r.append(fd) 134 r.append(fd)
135 # accepting sockets should not be writable 135 if is_w:
136 if is_w and not obj.accepting:
137 w.append(fd) 136 w.append(fd)
138 if is_r or is_w: 137 if is_r or is_w:
139 e.append(fd) 138 e.append(fd)
140 if [] == r == w == e: 139 if [] == r == w == e:
141 time.sleep(timeout) 140 time.sleep(timeout)
142 return 141 return
143 142
144 try: 143 try:
145 r, w, e = select.select(r, w, e, timeout) 144 r, w, e = select.select(r, w, e, timeout)
146 except select.error as err: 145 except select.error as err:
(...skipping 26 matching lines...) Expand all
173 map = socket_map 172 map = socket_map
174 if timeout is not None: 173 if timeout is not None:
175 # timeout is in milliseconds 174 # timeout is in milliseconds
176 timeout = int(timeout*1000) 175 timeout = int(timeout*1000)
177 pollster = select.poll() 176 pollster = select.poll()
178 if map: 177 if map:
179 for fd, obj in list(map.items()): 178 for fd, obj in list(map.items()):
180 flags = 0 179 flags = 0
181 if obj.readable(): 180 if obj.readable():
182 flags |= select.POLLIN | select.POLLPRI 181 flags |= select.POLLIN | select.POLLPRI
183 # accepting sockets should not be writable 182 if obj.writable():
184 if obj.writable() and not obj.accepting:
185 flags |= select.POLLOUT 183 flags |= select.POLLOUT
186 if flags: 184 if flags:
187 # Only check for exceptions if object was either readable 185 # Only check for exceptions if object was either readable
188 # or writable. 186 # or writable.
189 flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL 187 flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL
190 pollster.register(fd, flags) 188 pollster.register(fd, flags)
191 try: 189 try:
192 r = pollster.poll(timeout) 190 r = pollster.poll(timeout)
193 except select.error as err: 191 except select.error as err:
194 if err.args[0] != EINTR: 192 if err.args[0] != EINTR:
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 self.set_file(fd) 652 self.set_file(fd)
655 # set it to non-blocking mode 653 # set it to non-blocking mode
656 flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) 654 flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
657 flags = flags | os.O_NONBLOCK 655 flags = flags | os.O_NONBLOCK
658 fcntl.fcntl(fd, fcntl.F_SETFL, flags) 656 fcntl.fcntl(fd, fcntl.F_SETFL, flags)
659 657
660 def set_file(self, fd): 658 def set_file(self, fd):
661 self.socket = file_wrapper(fd) 659 self.socket = file_wrapper(fd)
662 self._fileno = self.socket.fileno() 660 self._fileno = self.socket.fileno()
663 self.add_channel() 661 self.add_channel()
OLDNEW
« no previous file with comments | « Lib/ast.py ('k') | Lib/binhex.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+