| 167 | } |
| 168 | |
| 169 | void keeper_conn::handle_task(task_req& task) |
| 170 | { |
| 171 | if (conn_ == NULL) { |
| 172 | connect_one(); |
| 173 | } |
| 174 | |
| 175 | socket_stream* conn; |
| 176 | if (conn_) { |
| 177 | // must dup the sock fd for moving the connection from |
| 178 | // one thread started in fiber schedule mode to another. |
| 179 | conn = dup_stream(*conn_); |
| 180 | delete conn_; |
| 181 | conn_ = NULL; |
| 182 | status_ = KEEPER_T_IDLE; |
| 183 | } else { |
| 184 | conn = NULL; |
| 185 | status_ = KEEPER_T_IDLE; |
| 186 | } |
| 187 | |
| 188 | // notify the request task with the connection |
| 189 | task.set_conn_cost(conn_cost_); |
| 190 | task.put(conn); |
| 191 | } |
| 192 | |
| 193 | void keeper_conn::connect_one() |
| 194 | { |
nothing calls this directly
no test coverage detected