Exemple #1
0
// _ServerInfoConnectionListener
int32
NetFSServer::_ServerInfoConnectionListener()
{
	if (fServerInfoConnectionListenerSocket < 0)
		return B_BAD_VALUE;

	TaskManager taskManager;

	// accept a incoming connection
	while (!fTerminating) {
		int fd = -1;
		do {
			taskManager.RemoveDoneTasks();

			fd = accept(fServerInfoConnectionListenerSocket, NULL, 0);
			if (fd < 0) {
				status_t error = errno;
				if (error != B_INTERRUPTED)
					return error;
				if (fTerminating)
					return B_OK;
			}
		} while (fd < 0);

		// get a fresh server info
		ServerInfo info;
		status_t error = _GetServerInfo(info);
		if (error != B_OK) {
			closesocket(fd);
			return error;
		}

		// create a server info sender thread
		ServerInfoSender* sender = new(std::nothrow) ServerInfoSender(fd, info);
		if (!sender || sender->Init() != B_OK) {
			closesocket(fd);
			delete sender;
		}
		taskManager.RunTask(sender);
	}

	return B_OK;
}
void TSServersInfo::onChannelGroupListFinishedEvent(uint64 serverConnectionHandlerID)
{
    TSServerInfo* tsServerInfo = _GetServerInfo(serverConnectionHandlerID,false);
    if (tsServerInfo)
        tsServerInfo->onChannelGroupListFinishedEvent();
}
void TSServersInfo::onChannelGroupListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char *name, int type, int iconID, int saveDB)
{
    TSServerInfo* tsServerInfo = _GetServerInfo(serverConnectionHandlerID,true);
    if (tsServerInfo)
        tsServerInfo->onChannelGroupListEvent(channelGroupID,name,type,iconID,saveDB);
}