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