mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 18:45:40 +08:00
Move log buffer to stack
Move log bufer to stack and remove mutex
This commit is contained in:
parent
e469e9e369
commit
83441eebc7
@ -622,27 +622,24 @@ void lognone(struct clientparam * param, const unsigned char *s) {
|
|||||||
if(param->trafcountfunc)(*param->trafcountfunc)(param);
|
if(param->trafcountfunc)(*param->trafcountfunc)(param);
|
||||||
clearstat(param);
|
clearstat(param);
|
||||||
}
|
}
|
||||||
unsigned char tmpbuf[8192];
|
|
||||||
|
|
||||||
void logstdout(struct clientparam * param, const unsigned char *s) {
|
void logstdout(struct clientparam * param, const unsigned char *s) {
|
||||||
FILE *log;
|
FILE *log;
|
||||||
|
unsigned char tmpbuf[8192];
|
||||||
|
|
||||||
pthread_mutex_lock(&log_mutex);
|
|
||||||
dobuf(param, tmpbuf, s, NULL);
|
dobuf(param, tmpbuf, s, NULL);
|
||||||
log = param->srv->stdlog?param->srv->stdlog:conf.stdlog?conf.stdlog:stdout;
|
log = param->srv->stdlog?param->srv->stdlog:conf.stdlog?conf.stdlog:stdout;
|
||||||
if(!param->nolog)if(fprintf(log, "%s\n", tmpbuf) < 0) {
|
if(!param->nolog)if(fprintf(log, "%s\n", tmpbuf) < 0) {
|
||||||
perror("printf()");
|
perror("printf()");
|
||||||
};
|
};
|
||||||
if(log != conf.stdlog)fflush(log);
|
if(log != conf.stdlog)fflush(log);
|
||||||
pthread_mutex_unlock(&log_mutex);
|
|
||||||
}
|
}
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
void logsyslog(struct clientparam * param, const unsigned char *s) {
|
void logsyslog(struct clientparam * param, const unsigned char *s) {
|
||||||
|
|
||||||
pthread_mutex_lock(&log_mutex);
|
unsigned char tmpbuf[8192];
|
||||||
dobuf(param, tmpbuf, s, NULL);
|
dobuf(param, tmpbuf, s, NULL);
|
||||||
if(!param->nolog)syslog(LOG_INFO, "%s", tmpbuf);
|
if(!param->nolog)syslog(LOG_INFO, "%s", tmpbuf);
|
||||||
pthread_mutex_unlock(&log_mutex);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user