0
@@ -64,7 +64,7 @@ int env_has_error(ebb_client *client)
0
#define DEF_MAX_LENGTH(N,length) const size_t MAX_##N##_LENGTH = length; const char *MAX_##N##_LENGTH_ERR = "HTTP Parse Error: HTTP element " # N " is longer than the " # length " allowed length."
0
/** Validates the max length of given input and throws an exception if over. */
0
-#define VALIDATE_MAX_LENGTH(len, N) if(len > MAX_##N##_LENGTH) { env_error(client); ebb_info(MAX_##N##_LENGTH_ERR); }
0
+#define VALIDATE_MAX_LENGTH(len, N) if(len > MAX_##N##_LENGTH) { env_error(client); g_message(MAX_##N##_LENGTH_ERR); }
0
/* Defines the maximum allowed lengths for various input elements.*/
0
DEF_MAX_LENGTH(FIELD_NAME, 256);
0
@@ -175,7 +175,7 @@ void on_timeout(struct ev_loop *loop, ev_timer *watcher, int revents)
0
ebb_client_close(client);
0
- ebb_info("peer timed out");
0
+ g_message("peer timed out");
0
@@ -199,7 +199,7 @@ void* read_body_into_file(void *_client)
0
sprintf(client->upload_file_filename, "/tmp/ebb_upload_%010d", id++);
0
tmpfile = fopen(client->upload_file_filename, "w+");
0
- if(tmpfile == NULL) ebb_error("Cannot open tmpfile %s", client->upload_file_filename);
0
+ if(tmpfile == NULL) g_message("Cannot open tmpfile %s", client->upload_file_filename);
0
client->upload_file = tmpfile;
0
size_t body_head_length = client->read - client->parser.nread;
0
@@ -217,7 +217,7 @@ void* read_body_into_file(void *_client)
0
- // ebb_debug("wrote request header to file. written: %d, content_length: %d", written, client->content_length);
0
+ // g_debug("wrote request header to file. written: %d, content_length: %d", written, client->content_length);
0
@@ -245,7 +245,7 @@ void* read_body_into_file(void *_client)
0
- // ebb_debug("%d bytes written to file %s", written, client->upload_file_filename);
0
+ // g_debug("%d bytes written to file %s", written, client->upload_file_filename);
0
ebb_client_close(client);
0
@@ -299,7 +299,7 @@ void on_readable(struct ev_loop *loop, ev_io *watcher, int revents)
0
- if(read < 0) ebb_warning("Error recving data: %s", strerror(errno));
0
+ if(read < 0) g_message("Error recving data: %s", strerror(errno));
0
ebb_client_close(client);
0
@@ -311,7 +311,7 @@ void on_request(struct ev_loop *loop, ev_io *watcher, int revents)
0
assert(&server->request_watcher == watcher);
0
if(EV_ERROR & revents) {
0
- ebb_info("on_request() got error event, closing server.");
0
+ g_message("on_request() got error event, closing server.");
0
ebb_server_unlisten(server);
0
@@ -337,7 +337,7 @@ void on_request(struct ev_loop *loop, ev_io *watcher, int revents)
0
for(i = 0; i < EBB_MAX_CLIENTS; i++)
0
if(server->clients[i].open) count += 1;
0
- ebb_debug("%d open connections", count);
0
+ g_debug("%d open connections", count);
0
client->server = server;
0
@@ -426,17 +426,15 @@ void ebb_server_free(ebb_server *server)
0
void ebb_server_unlisten(ebb_server *server)
0
- ebb_info("Stopping Ebb server");
0
+ //g_message("Stopping Ebb server");
0
- for(i=0; i < EBB_MAX_CLIENTS; i++)
0
- ebb_client_close(client);
0
+ //for(i=0; i < EBB_MAX_CLIENTS; i++)
0
+ // ebb_client_close(client);
0
ev_io_stop(server->loop, &server->request_watcher);
0
- if(server->socketpath)
0
- unlink(server->socketpath);
0
+ if(server->socketpath)
0
+ unlink(server->socketpath);
0
@@ -510,12 +508,12 @@ void on_client_writable(struct ev_loop *loop, ev_io *watcher, int revents)
0
if(EV_ERROR & revents) {
0
- ebb_error("on_client_writable() got error event, closing peer");
0
+ g_message("on_client_writable() got error event, closing peer");
0
//if(client->written != 0)
0
- // ebb_debug("total written: %d", (int)(client->written));
0
+ // g_debug("total written: %d", (int)(client->written));
0
sent = send( client->fd
0
, client->response_buffer->str + sizeof(gchar)*(client->written)
0
@@ -524,7 +522,7 @@ void on_client_writable(struct ev_loop *loop, ev_io *watcher, int revents)
0
- ebb_warning("Error writing: %s", strerror(errno));
0
+ g_message("Error writing: %s", strerror(errno));
0
ebb_client_close(client);
0
@@ -532,7 +530,7 @@ void on_client_writable(struct ev_loop *loop, ev_io *watcher, int revents)
0
client->written += sent;
0
assert(client->written <= client->response_buffer->len);
0
- //ebb_info("wrote %d bytes. total: %d", (int)sent, (int)(client->written));
0
+ //g_message("wrote %d bytes. total: %d", (int)sent, (int)(client->written));
0
ev_timer_again(loop, &(client->timeout_watcher));
0
@@ -620,9 +618,9 @@ static int server_socket(const int port) {
0
setsockopt(sfd, SOL_SOCKET, SO_REUSEADDR, (void *)&flags, sizeof(flags));
0
- // setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
0
- // setsockopt(sfd, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
0
- // setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
0
+ setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
0
+ setsockopt(sfd, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
0
+ setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
0
* the memset call clears nonstandard fields in some impementations
0
@@ -701,7 +699,7 @@ static int server_socket_unix(const char *path, int access_mask) {
0
- if (listen(sfd, 1024) == -1) {
0
+ if (listen(sfd, EBB_MAX_CLIENTS) == -1) {
Comments
No one has commented yet.