示例#1
0
文件: server.c 项目: mannias/SO
int main() {
	int fd;
	Message* data;
	head = tail = NULL;
	mailhead = mailtail = NULL;
	users = createList(NULL);
	initUserList("csv/users.csv", users);
	createConnection(0);
	signal(SIGINT, dumpAll);

    initPthread();

	while(1){
		// fd = acceptConnection(0);
		// data = (Message*)listenMessage(fd, sizeof(Message));
		// if(data != NULL){
		// 	if(strcmp(data->resource, "client") == 0){
		// 		if(strcmp(data->method, "register") == 0){
		// 			registerClient(data->referer, fd);
		// 			cloneConnection(data);
		// 		}else{
		// 			printf("Error on basic connection to server 2\n");
		// 		}
		// 	}else{
		// 		printf("Error on basic connection to server 1\n");
		// 	}

		// }
	}
	// closeConnection(0);
	return 1;
}
示例#2
0
int main(int argc, char *argv[]) {

    list *l = listCreate();
    char u[] = "user1,user2,user3";
    ASSERT(3 == initUserList(l, u));

    ASSERT(listSearchKey(l, "user1"));
    ASSERT(listSearchKey(l, "user2"));
    ASSERT(listSearchKey(l, "user3"));
    ASSERT(NULL == listSearchKey(l, "user4"));

    /* wrong
        ASSERT(NULL == listSearchKey(l, "user1"));
    */

    return OK;
}