Fix connection abortion
This commit is contained in:
parent
cdaab8fdf0
commit
13d3299816
15
src/kike.c
15
src/kike.c
@ -381,7 +381,7 @@ static bool
|
|||||||
irc_try_read (struct connection *conn)
|
irc_try_read (struct connection *conn)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -413,7 +413,7 @@ irc_try_read_ssl (struct connection *conn)
|
|||||||
return true;
|
return true;
|
||||||
case SSL_ERROR_WANT_WRITE:
|
case SSL_ERROR_WANT_WRITE:
|
||||||
conn->ssl_rx_want_tx = true;
|
conn->ssl_rx_want_tx = true;
|
||||||
return false;
|
return true;
|
||||||
case XSSL_ERROR_TRY_AGAIN:
|
case XSSL_ERROR_TRY_AGAIN:
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
@ -428,7 +428,7 @@ static bool
|
|||||||
irc_try_write (struct connection *conn)
|
irc_try_write (struct connection *conn)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -456,7 +456,7 @@ irc_try_write_ssl (struct connection *conn)
|
|||||||
return true;
|
return true;
|
||||||
case SSL_ERROR_WANT_READ:
|
case SSL_ERROR_WANT_READ:
|
||||||
conn->ssl_tx_want_rx = true;
|
conn->ssl_tx_want_rx = true;
|
||||||
return false;
|
return true;
|
||||||
case XSSL_ERROR_TRY_AGAIN:
|
case XSSL_ERROR_TRY_AGAIN:
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
@ -483,13 +483,13 @@ on_irc_client_ready (const struct pollfd *pfd, void *user_data)
|
|||||||
conn->initialized = true;
|
conn->initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: aborting a connection inside try_read() will fuck things up
|
|
||||||
int new_events = 0;
|
int new_events = 0;
|
||||||
if (conn->ssl)
|
if (conn->ssl)
|
||||||
{
|
{
|
||||||
// Reads may want to write, writes may want to read, poll() may
|
// Reads may want to write, writes may want to read, poll() may
|
||||||
// return unexpected things in `revents'... let's try both
|
// return unexpected things in `revents'... let's try both
|
||||||
irc_try_read_ssl (conn) && irc_try_write_ssl (conn);
|
if (!irc_try_read_ssl (conn) || !irc_try_write_ssl (conn))
|
||||||
|
return;
|
||||||
|
|
||||||
new_events |= POLLIN;
|
new_events |= POLLIN;
|
||||||
if (conn->write_buffer.len || conn->ssl_rx_want_tx)
|
if (conn->write_buffer.len || conn->ssl_rx_want_tx)
|
||||||
@ -501,7 +501,8 @@ on_irc_client_ready (const struct pollfd *pfd, void *user_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
irc_try_read (conn) && irc_try_write (conn);
|
if (!irc_try_read (conn) || !irc_try_write (conn))
|
||||||
|
return;
|
||||||
|
|
||||||
new_events |= POLLIN;
|
new_events |= POLLIN;
|
||||||
if (conn->write_buffer.len)
|
if (conn->write_buffer.len)
|
||||||
|
Loading…
Reference in New Issue
Block a user