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

Side by Side Diff: Lib/socketserver.py

Issue 22043: Use a monotonic clock to compute timeouts
Patch Set: Created 3 years 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/sched.py ('k') | Lib/subprocess.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 """Generic socket server classes. 1 """Generic socket server classes.
2 2
3 This module tries to capture the various aspects of defining a server: 3 This module tries to capture the various aspects of defining a server:
4 4
5 For socket-based servers: 5 For socket-based servers:
6 6
7 - address family: 7 - address family:
8 - AF_INET{,6}: IP (Internet Protocol) sockets (default) 8 - AF_INET{,6}: IP (Internet Protocol) sockets (default)
9 - AF_UNIX: Unix domain sockets 9 - AF_UNIX: Unix domain sockets
10 - others, e.g. AF_DECNET are conceivable (see <socket.h> 10 - others, e.g. AF_DECNET are conceivable (see <socket.h>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 130
131 import socket 131 import socket
132 import selectors 132 import selectors
133 import os 133 import os
134 import errno 134 import errno
135 try: 135 try:
136 import threading 136 import threading
137 except ImportError: 137 except ImportError:
138 import dummy_threading as threading 138 import dummy_threading as threading
139 try: 139 from time import monotonic as time
140 from time import monotonic as time
141 except ImportError:
142 from time import time as time
143 140
144 __all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer", 141 __all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
145 "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler", 142 "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
146 "StreamRequestHandler","DatagramRequestHandler", 143 "StreamRequestHandler","DatagramRequestHandler",
147 "ThreadingMixIn", "ForkingMixIn"] 144 "ThreadingMixIn", "ForkingMixIn"]
148 if hasattr(socket, "AF_UNIX"): 145 if hasattr(socket, "AF_UNIX"):
149 __all__.extend(["UnixStreamServer","UnixDatagramServer", 146 __all__.extend(["UnixStreamServer","UnixDatagramServer",
150 "ThreadingUnixStreamServer", 147 "ThreadingUnixStreamServer",
151 "ThreadingUnixDatagramServer"]) 148 "ThreadingUnixDatagramServer"])
152 149
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 """Define self.rfile and self.wfile for datagram sockets.""" 752 """Define self.rfile and self.wfile for datagram sockets."""
756 753
757 def setup(self): 754 def setup(self):
758 from io import BytesIO 755 from io import BytesIO
759 self.packet, self.socket = self.request 756 self.packet, self.socket = self.request
760 self.rfile = BytesIO(self.packet) 757 self.rfile = BytesIO(self.packet)
761 self.wfile = BytesIO() 758 self.wfile = BytesIO()
762 759
763 def finish(self): 760 def finish(self):
764 self.socket.sendto(self.wfile.getvalue(), self.client_address) 761 self.socket.sendto(self.wfile.getvalue(), self.client_address)
OLDNEW
« no previous file with comments | « Lib/sched.py ('k') | Lib/subprocess.py » ('j') | no next file with comments »

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