#include <stdio.h>
#include <time.h>
-int __osrfChatXMLErrorOcurred = 0;
-int __osrfChatClientSentDisconnect = 0;
+static int osrfChatXMLErrorOcurred = 0;
+static int osrfChatClientSentDisconnect = 0;
/* shorter version of strcmp */
static int eq(const char* a, const char* b) { return (a && b && !strcmp(a,b)); }
server->deadNodes = osrfNewList();
server->nodeList->freeItem = &osrfChatNodeFree;
server->domain = strdup(domain);
+ server->secret = strdup(secret);
server->s2sport = s2sport;
+ server->port = 0;
+ // Build socket manager
server->mgr = safe_malloc(sizeof(socket_manager));
server->mgr->data_received = &osrfChatHandleData;
server->mgr->blob = server;
server->mgr->on_socket_closed = &osrfChatSocketClosed;
- if(secret) server->secret = strdup(secret);
return server;
}
if(!server) return;
osrfHashFree(server->nodeHash);
osrfListFree(server->nodeList);
+ osrfListFree(server->deadNodes);
free(server->mgr);
+ free(server->domain);
free(server->secret);
+
+ free(server);
}
xmlParseChunk(node->parserCtx, data, strlen(data), 0);
node->inparse = 0;
- if(__osrfChatXMLErrorOcurred) {
- __osrfChatXMLErrorOcurred = 0;
+ if(osrfChatXMLErrorOcurred) {
+ osrfChatXMLErrorOcurred = 0;
return -1;
}
/* we can't do cleanup of the XML handlers while in the middle of a
data push, so set flags in the data push and doe the cleanup here */
/*
- if(__osrfChatClientSentDisconnect) {
- __osrfChatClientSentDisconnect = 0;
+ if(osrfChatClientSentDisconnect) {
+ osrfChatClientSentDisconnect = 0;
osrfChatNodeFinish( server, node );
}
*/
void osrfChatParseError( void* blob, const char* msg, ... ) {
- __osrfChatXMLErrorOcurred = 1;
+ osrfChatXMLErrorOcurred = 1;
}