Squid url redirector

Check-in [6c8b368359]
anonymous

Check-in [6c8b368359]

Overview
Comment:fixed hang on pipe closing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 6c8b3683590dcf8ae619a6d5c255c4d3fe139dcff0e2fd385c9ef6bb909b30bd
User & Date: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2010-08-07 21:12:22.000
Other Links: branch diff | manifest | tags
Context
2010-08-07
21:13
major definition reorder: table creation first then functions check-in: 7828f877c8 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
21:12
fixed hang on pipe closing check-in: 6c8b368359 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
19:52
working kqueue version check-in: 26fc9b34d9 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
Changes
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205



206
207
208
209
210
211
212
		timeout = None
		eof = False
		buffer = ''
		while True:
			# checking if there is any data or witing for data to arrive
			kevs = self._kq.control(None, 1, timeout)
			if len(kevs) > 0 and kevs[0].filter == self._select.KQ_FILTER_READ and kevs[0].data > 0:
				# if kq reports en of stream refuse to read more of it
				if kevs[0].flags >> 15 == 1:
					eof = True
				else:
					# reading data in
					new_buffer = sys.stdin.read(kevs[0].data)
					# if no data was sent - we have reached and of file
					if len(new_buffer) == 0:
						eof = True
					else:
						# adding current buffer to old buffer remains
						buffer += new_buffer
						# splitting to lines
						lines = buffer.split('\n')
						# last line that was not terminate by newline returns to buffer
						buffer = lines[-1]
						# an only if there was at least one newline
						if len(lines) > 1:
							for line in lines[:-1]:
								# add data to the queue
								if self.check(line + '\n'):
									# don't wait for more data, start processing
									timeout = 0



			else:
				if len(self._queue) > 0:
					req = self._queue.pop(0)
					Checker.process(self, req[0], req[1], req[2], req[3])
					if len(self._queue) == 0:
						# wait for data - we have nothing to process
						timeout = None







<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>







176
177
178
179
180
181
182




183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
		timeout = None
		eof = False
		buffer = ''
		while True:
			# checking if there is any data or witing for data to arrive
			kevs = self._kq.control(None, 1, timeout)
			if len(kevs) > 0 and kevs[0].filter == self._select.KQ_FILTER_READ and kevs[0].data > 0:




				# reading data in
				new_buffer = sys.stdin.read(kevs[0].data)
				# if no data was sent - we have reached and of file
				if len(new_buffer) == 0:
					eof = True
				else:
					# adding current buffer to old buffer remains
					buffer += new_buffer
					# splitting to lines
					lines = buffer.split('\n')
					# last line that was not terminate by newline returns to buffer
					buffer = lines[-1]
					# an only if there was at least one newline
					if len(lines) > 1:
						for line in lines[:-1]:
							# add data to the queue
							if self.check(line + '\n'):
								# don't wait for more data, start processing
								timeout = 0
				# if kq reports en of stream refuse to read more of it
				if kevs[0].flags >> 15 == 1:
					eof = True
			else:
				if len(self._queue) > 0:
					req = self._queue.pop(0)
					Checker.process(self, req[0], req[1], req[2], req[3])
					if len(self._queue) == 0:
						# wait for data - we have nothing to process
						timeout = None