zlib_stream_t *stream = conn->stream;
inflateEnd(&stream->instream);
deflateEnd(&stream->outstream);
+ rb_free(stream);
}
#endif
rb_free(conn);
rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn);
rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL);
va_start(ap, fmt);
- rb_vsnprintf(reason, sizeof(reason), fmt, ap);
+ vsnprintf(reason, sizeof(reason), fmt, ap);
va_end(ap);
buf[0] = 'D';
SetSSL(conn);
if(rb_get_type(conn->mod_fd) & RB_FD_UNKNOWN)
- {
-
rb_set_type(conn->mod_fd, RB_FD_SOCKET);
- }
- if(rb_get_type(conn->mod_fd) == RB_FD_UNKNOWN)
+
+ if(rb_get_type(conn->plain_fd) == RB_FD_UNKNOWN)
rb_set_type(conn->plain_fd, RB_FD_SOCKET);
rb_ssl_start_accepted(ctlb->F[0], ssl_process_accept_cb, conn, 10);
if(rb_get_type(conn->mod_fd) == RB_FD_UNKNOWN)
rb_set_type(conn->mod_fd, RB_FD_SOCKET);
- if(rb_get_type(conn->mod_fd) == RB_FD_UNKNOWN)
+ if(rb_get_type(conn->plain_fd) == RB_FD_UNKNOWN)
rb_set_type(conn->plain_fd, RB_FD_SOCKET);
if(conn == NULL)
return;
- rb_snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata,
- conn->plain_out, conn->mod_in, conn->plain_in, conn->mod_out);
+ snprintf(outstat, sizeof(outstat), "S %s %llu %llu %llu %llu", odata,
+ (unsigned long long)conn->plain_out,
+ (unsigned long long)conn->mod_in,
+ (unsigned long long)conn->plain_in,
+ (unsigned long long)conn->mod_out);
conn->plain_out = 0;
conn->plain_in = 0;
conn->mod_in = 0;
uint32_t id = buf_to_uint32(&ctlb->buf[1]);
uint32_t newid = buf_to_uint32(&ctlb->buf[5]);
conn_t *conn = conn_find_by_id(id);
+ lrb_assert(conn != NULL);
+ if(conn == NULL)
+ {
+ uint8_t buf[256];
+ int len;
+
+ buf[0] = 'D';
+ uint32_to_buf(&buf[1], newid);
+ sprintf((char *) &buf[5], "connid %d does not exist", id);
+ len = (strlen((char *) &buf[5]) + 1) + 5;
+ mod_cmd_write_queue(ctl, buf, len);
+
+ return;
+ }
rb_dlinkDelete(&conn->node, connid_hash(conn->id));
SetZipSSL(conn);
conn->id = newid;
ssl_new_keys(mod_ctl_t * ctl, mod_ctl_buf_t * ctl_buf)
{
char *buf;
- char *cert, *key, *dhparam;
+ char *cert, *key, *dhparam, *cipher_list;
buf = (char *) &ctl_buf->buf[2];
cert = buf;
dhparam = buf;
if(strlen(dhparam) == 0)
dhparam = NULL;
+ buf += strlen(dhparam) + 1;
+ cipher_list = buf;
+ if(strlen(cipher_list) == 0)
+ cipher_list = NULL;
- if(!rb_setup_ssl_server(cert, key, dhparam))
+ if(!rb_setup_ssl_server(cert, key, dhparam, cipher_list))
{
const char *invalid = "I";
mod_cmd_write_queue(ctl, invalid, strlen(invalid));