Close the connection and free resources. */
| 146 | |
| 147 | /* Close the connection and free resources. */ |
| 148 | static void connSocketClose(connection *conn) { |
| 149 | if (conn->fd != -1) { |
| 150 | aeDeleteFileEvent(server.el,conn->fd, AE_READABLE | AE_WRITABLE); |
| 151 | close(conn->fd); |
| 152 | conn->fd = -1; |
| 153 | } |
| 154 | |
| 155 | /* If called from within a handler, schedule the close but |
| 156 | * keep the connection until the handler returns. |
| 157 | */ |
| 158 | if (connHasRefs(conn)) { |
| 159 | conn->flags |= CONN_FLAG_CLOSE_SCHEDULED; |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | zfree(conn); |
| 164 | } |
| 165 | |
| 166 | static int connSocketWrite(connection *conn, const void *data, size_t data_len) { |
| 167 | int ret = write(conn->fd, data, data_len); |
nothing calls this directly
no test coverage detected