diff options
| author | Anton <anton@picapica> | 2015-04-15 02:17:43 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2015-04-15 02:17:43 +0400 |
| commit | 30b06d7d978120561f617271c0597763b864c934 (patch) | |
| tree | 182c1c83c17b00366150bee06d32d54fc10da2b9 /PICA_client.c | |
| parent | 9147cd24d5b749d9e74ad308fb059f79c7abf115 (diff) | |
| download | pica-pica-30b06d7d978120561f617271c0597763b864c934.tar.gz pica-pica-30b06d7d978120561f617271c0597763b864c934.zip | |
PICA_event_loop() implementation, mostly completed
Diffstat (limited to 'PICA_client.c')
| -rwxr-xr-x | PICA_client.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/PICA_client.c b/PICA_client.c index 1f52e5c..141d35c 100755 --- a/PICA_client.c +++ b/PICA_client.c @@ -1585,16 +1585,33 @@ while(ic2n && *ic2n) ret = process_c2n(*ic2n, &rfds, &wfds); - ic2c = (*ic2n)->chan_list_head; - - //processing c2c connections associated with current c2n - while(ic2c) + if (ret != PICA_OK) { - ret = process_c2c(ic2c, &rfds, &wfds); - - ic2c = ic2c->next; + PICA_close_c2n(*ic2n); } + else + { + struct PICA_c2c *kill_ptr = 0; + ic2c = (*ic2n)->chan_list_head; + + //processing c2c connections associated with current c2n + while(ic2c) + { + ret = process_c2c(ic2c, &rfds, &wfds); + + if (ret != PICA_OK) + kill_ptr = ic2c; + + ic2c = ic2c->next; + + if (kill_ptr) + { + PICA_close_c2c(kill_ptr); + kill_ptr = 0; + } + } + } ic2n++; } |
