cleanup...now the xmpp thread will not suck your cpu

This commit is contained in:
barrett 2011-04-09 02:35:20 +00:00
parent 556436ef77
commit c92a7038d0
2 changed files with 5 additions and 3 deletions

View File

@ -191,7 +191,7 @@ status_t
MSNP::Process(BMessage* msg) MSNP::Process(BMessage* msg)
{ {
// printf("Process()\n"); // printf("Process()\n");
msg->PrintToStream(); // msg->PrintToStream();
switch (msg->what) { switch (msg->what) {
case IM_MESSAGE: case IM_MESSAGE:
@ -314,6 +314,7 @@ MSNP::Process(BMessage* msg)
y = x; y = x;
} else { } else {
delete fSwitchboardList.ItemAt(x)->second; delete fSwitchboardList.ItemAt(x)->second;
//delete fSwitchboardList.ItemAt(x)->first;
fSwitchboardList.RemoveItemAt(x); fSwitchboardList.RemoveItemAt(x);
} }
break; break;
@ -1066,7 +1067,7 @@ int MSNP::listenOnPort(int port)
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(port); addr.sin_port = htons((uint16)port);
if (bind(s, (sockaddr *)(&addr), sizeof(addr)) < 0 || listen(s, 1) < 0) { if (bind(s, (sockaddr *)(&addr), sizeof(addr)) < 0 || listen(s, 1) < 0) {
close(s); close(s);

View File

@ -25,6 +25,7 @@
static status_t static status_t
connect_thread(void* data) connect_thread(void* data)
{ {
JabberHandler* handler = (JabberHandler*)data; JabberHandler* handler = (JabberHandler*)data;
if (!handler) if (!handler)
return B_BAD_VALUE; return B_BAD_VALUE;
@ -34,7 +35,7 @@ connect_thread(void* data)
return B_BAD_VALUE; return B_BAD_VALUE;
gloox::ConnectionError e; gloox::ConnectionError e;
while ((e = client->recv(1000)) == gloox::ConnNoError); while ((e = client->recv(10000000)) == gloox::ConnNoError);
if (e != gloox::ConnUserDisconnected) if (e != gloox::ConnUserDisconnected)
handler->HandleError(e); handler->HandleError(e);