void *do_smb_proxy (void *param){ /* 屏蔽信号SIGPIPE*/
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
struct parse_result *result;
result = (struct parse_result)malloc(sizeof(struct parse_result)); int usersockfd = (struct session)param->usersockfd; int isosockfd = (struct session)param->isosockfd;
userbuf = (char *)malloc(maxsize); // 错误处理
serverbuf = (char *)malloc(maxsize); // 错误处理
while (1)
{ // 监听用户端和服务端套接字
FD_ZERO (&rdfdset);
FD_SET (usersockfd, &rdfdset);
FD_SET (isosockfd, &rdfdset);
dbg("*****wait the message*********\n");
if (select (FD_SETSIZE, &rdfdset, NULL, NULL, NULL)
{ goto Error;
}
if (FD_ISSET (usersockfd, &rdfdset))
{ memset(userbuf, 0, maxsize); if ((useriolen = read (usersockfd, userbuf, maxsize)) <= 0)
{ goto Error;
}