7.4.00
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "coc_logfile.h"
|
||||
#include "coc_server.h"
|
||||
#include "str_util.h"
|
||||
#include <fortify.h>
|
||||
|
||||
static Str_Buf *buf, *bufo;
|
||||
|
||||
@@ -46,7 +45,7 @@ int CocInitServer(int bufsize, int port) {
|
||||
ERR_SI(setsockopt(mainFd,SOL_SOCKET,SO_REUSEADDR,&i,sizeof(int))); /* allow quick port reuse */
|
||||
ERR_I(CocCreateSockAdr(&sadr, NULL, port));
|
||||
ERR_SI(bind(mainFd, (struct sockaddr *)&sadr, sizeof(sadr)));
|
||||
logfileOut(LOG_MAIN, "created server on port %d\n", port);
|
||||
logfileOut(LOG_INFO, "created server on port %d\n", port);
|
||||
ERR_SI(listen(mainFd, 8));
|
||||
FD_ZERO(&mask);
|
||||
FD_SET(mainFd, &mask);
|
||||
@@ -86,9 +85,9 @@ int CocHandle1Request(int tmo_msec, int fd) {
|
||||
cList->next=cl;
|
||||
h=gethostbyaddr(&cadr.sin_addr, 4, AF_INET);
|
||||
if (h==NULL) {
|
||||
logfileOut(LOG_MAIN, "(%d) open from %s\n", newfd, "local");
|
||||
logfileOut(LOG_INFO, "(%d) open from %s\n", newfd, "local");
|
||||
} else {
|
||||
logfileOut(LOG_MAIN, "(%d) open from %s\n", newfd, h->h_name);
|
||||
logfileOut(LOG_INFO, "(%d) open from %s\n", newfd, h->h_name);
|
||||
}
|
||||
} else {
|
||||
cl0=cList; cl=cl0->next;
|
||||
@@ -96,7 +95,7 @@ int CocHandle1Request(int tmo_msec, int fd) {
|
||||
if (FD_ISSET(cl->fd, &rmask)) {
|
||||
buf->wrpos=recv(cl->fd, buf->buf, buf->dsize, 0);
|
||||
if (buf->wrpos<=0) {
|
||||
logfileOut(LOG_MAIN, "(%d) disconnected\n",cl->fd);
|
||||
logfileOut(LOG_INFO, "(%d) disconnected\n",cl->fd);
|
||||
close(cl->fd);
|
||||
FD_CLR(cl->fd, &mask);
|
||||
cl0->next=cl->next;
|
||||
@@ -113,10 +112,10 @@ int CocHandle1Request(int tmo_msec, int fd) {
|
||||
logfileOut(LOG_NET, "(%d) ", cl->fd);
|
||||
if (varname[0]=='#') { /* access code */
|
||||
if (0==strcmp(varname,"#rdacc")) {
|
||||
logfileOut(LOG_MAIN, "set read mode\n");
|
||||
logfileOut(LOG_INFO, "set read mode\n");
|
||||
cl->mode=1;
|
||||
} else if (0==strcmp(varname,"#rwacs")) {
|
||||
logfileOut(LOG_MAIN, "set write mode\n");
|
||||
logfileOut(LOG_INFO, "set write mode\n");
|
||||
cl->mode=2;
|
||||
} else {
|
||||
err="bad access code";
|
||||
|
||||
Reference in New Issue
Block a user