@@ -98,23 +98,23 @@ def update_poll(self):
98
98
"""
99
99
self .client_available ()
100
100
if (self ._client_sock and self ._client_sock .available ()):
101
- # self.print_remote_ip()
102
101
environ = self ._get_environ (self ._client_sock )
103
102
result = self .application (environ , self ._start_response )
104
103
self .finish_response (result )
105
104
"""
106
105
Optional routine to control what IP connects to your ESP server
107
106
as it forces a single connection as the server can't handle more
108
107
than one request at a time.
108
+
109
+ self.client_available()
110
+ if (self._client_sock and self._client_sock.available()):
111
+ result = self.check_remote_ip()
112
+ if result == "192.168.4.2":
113
+ self.print_remote_ip()
114
+ environ = self._get_environ(self._client_sock)
115
+ result = self.application(environ, self._start_response)
116
+ self.finish_response(result)
109
117
"""
110
- # self.client_available()
111
- # if (self._client_sock and self._client_sock.available()):
112
- # result = self.check_remote_ip()
113
- # if result == "192.168.4.2":
114
- # self.print_remote_ip()
115
- # environ = self._get_environ(self._client_sock)
116
- # result = self.application(environ, self._start_response)
117
- # self.finish_response(result)
118
118
119
119
def finish_response (self , result ):
120
120
"""
@@ -231,11 +231,18 @@ def _get_environ(self, client):
231
231
232
232
return env
233
233
234
+ """
235
+ Method that allows functionality to control what IP is connecting
236
+ to the server.
237
+ """
234
238
def check_remote_ip (self ):
235
239
sock_num = self ._client_sock .socknum
236
240
remote_ip = _the_interface .get_remote_data (sock_num )
237
241
return _the_interface .pretty_ip (remote_ip )
238
242
243
+ """
244
+ Method that prints the remote IP that is connecting to the server.
245
+ """
239
246
def print_remote_ip (self ):
240
247
sock_num = self ._client_sock .socknum
241
248
remote_ip = _the_interface .get_remote_data (sock_num )
0 commit comments