(self, stream, status)
| 171 | self._server.update_activity(self, data_len) |
| 172 | |
| 173 | def _update_stream(self, stream, status): |
| 174 | # update a stream to a new waiting status |
| 175 | |
| 176 | # check if status is changed |
| 177 | # only update if dirty |
| 178 | dirty = False |
| 179 | if stream == STREAM_DOWN: |
| 180 | if self._downstream_status != status: |
| 181 | self._downstream_status = status |
| 182 | dirty = True |
| 183 | elif stream == STREAM_UP: |
| 184 | if self._upstream_status != status: |
| 185 | self._upstream_status = status |
| 186 | dirty = True |
| 187 | if not dirty: |
| 188 | return |
| 189 | |
| 190 | if self._local_sock: |
| 191 | event = eventloop.POLL_ERR |
| 192 | if self._downstream_status & WAIT_STATUS_WRITING: |
| 193 | event |= eventloop.POLL_OUT |
| 194 | if self._upstream_status & WAIT_STATUS_READING: |
| 195 | event |= eventloop.POLL_IN |
| 196 | self._loop.modify(self._local_sock, event) |
| 197 | if self._remote_sock: |
| 198 | event = eventloop.POLL_ERR |
| 199 | if self._downstream_status & WAIT_STATUS_READING: |
| 200 | event |= eventloop.POLL_IN |
| 201 | if self._upstream_status & WAIT_STATUS_WRITING: |
| 202 | event |= eventloop.POLL_OUT |
| 203 | self._loop.modify(self._remote_sock, event) |
| 204 | |
| 205 | def _write_to_sock(self, data, sock): |
| 206 | # write data to sock |
no test coverage detected