Some changes handling g_input_add() - maybe this helps to problems

where irssi sometimes eats all the cpu.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@608 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-08-15 00:22:08 +00:00 committed by cras
commit 3baf7fbd4c
6 changed files with 16 additions and 13 deletions

View file

@ -37,12 +37,18 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition,
IRSSI_INPUT_REC *rec = data;
GInputCondition icond = 0;
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
/* error, we have to call the function.. */
if (rec->condition & G_IO_IN)
icond |= G_INPUT_READ;
else
icond |= G_INPUT_WRITE;
}
if (condition & (G_IO_IN | G_IO_PRI))
icond |= G_INPUT_READ;
if (condition & G_IO_OUT)
icond |= G_INPUT_WRITE;
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
icond |= G_INPUT_EXCEPTION;
if (rec->condition & icond) {
rec->function(rec->data, g_io_channel_unix_get_fd(source),
@ -58,19 +64,18 @@ int g_input_add(int source, GInputCondition condition,
IRSSI_INPUT_REC *rec;
unsigned int result;
GIOChannel *channel;
GIOCondition cond = 0;
GIOCondition cond;
rec = g_new(IRSSI_INPUT_REC, 1);
rec->condition = condition;
rec->function = function;
rec->data = data;
cond = G_IO_ERR|G_IO_HUP|G_IO_NVAL;
if (condition & G_INPUT_READ)
cond |= (G_IO_IN | G_IO_PRI);
cond |= G_IO_IN|G_IO_PRI;
if (condition & G_INPUT_WRITE)
cond |= G_IO_OUT;
if (condition & G_INPUT_EXCEPTION)
cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL;
channel = g_io_channel_unix_new (source);
result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,

View file

@ -176,8 +176,7 @@ static void server_connect_callback_readpipe(SERVER_REC *server)
server->handle = net_sendbuffer_create(handle, 0);
server->connect_tag =
g_input_add(handle, G_INPUT_WRITE | G_INPUT_READ |
G_INPUT_EXCEPTION,
g_input_add(handle, G_INPUT_WRITE | G_INPUT_READ,
(GInputFunction) server_connect_callback_init,
server);
signal_emit("server connecting", 2, server, &iprec.ip);