Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 1570:3d4c85664dad
Reduce the CPU usage when the server is unreachable
Based on a patch from Alex Gordeev
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 11 Apr 2009 12:05:27 +0200 |
parents | 3df441efb7c2 |
children | 5bb4b580f229 |
comparison
equal
deleted
inserted
replaced
1569:21c553e4bfb9 | 1570:3d4c85664dad |
---|---|
262 tv.tv_sec = 30; | 262 tv.tv_sec = 30; |
263 // Let's first update the screen, we could sleep for a long time... | 263 // Let's first update the screen, we could sleep for a long time... |
264 scr_DoUpdate(); | 264 scr_DoUpdate(); |
265 } | 265 } |
266 // If we're not connected, sleep for a while... | 266 // If we're not connected, sleep for a while... |
267 select(maxfd + 1, &fds, NULL, NULL, &tv); | 267 if (!online) { |
268 if (!online) | 268 select(1, &fds, NULL, NULL, &tv); |
269 check_connection(); | 269 check_connection(); |
270 else | 270 } else { |
271 select(maxfd + 1, &fds, NULL, NULL, &tv); | |
271 jab_start(jc); | 272 jab_start(jc); |
273 } | |
272 return; | 274 return; |
273 } | 275 } |
274 | 276 |
275 time(&now); | 277 time(&now); |
276 | 278 |