Spring 2020 version

This commit is contained in:
Godmar Back 2020-04-17 16:16:11 -04:00
parent 650c2dd851
commit cd09eb1954
5 changed files with 19 additions and 2 deletions

View File

@ -4,6 +4,11 @@
# Run this script to install the required Jansson and JWT packages.
#
BASE=`pwd`
#
# Running this script multiple times will wipe the existing build
# and reclone both repositories
/bin/rm -rf ${BASE}/deps jansson libjwt
#
test -d ${BASE}/deps || mkdir ${BASE}/deps
git clone https://github.com/akheron/jansson.git
(cd jansson;

View File

@ -22,4 +22,4 @@ server: $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
clean:
/bin/rm $(OBJ) $(OTHERS)
/bin/rm -f $(OBJ) $(OTHERS) server

View File

@ -3,7 +3,8 @@
#include "buffer.h"
struct bufio;
struct bufio; // opaque type
// users should interact only via the public functions below
struct bufio * bufio_create(int socket);
void bufio_close(struct bufio * self);
void bufio_truncate(struct bufio * self);

View File

@ -74,6 +74,7 @@ main(int ac, char *av[])
case 'e':
token_expiration_time = atoi(optarg);
fprintf(stderr, "token expiration time is %d\n", token_expiration_time);
break;
case 's':

View File

@ -13,6 +13,7 @@
#include <sys/sendfile.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
@ -127,6 +128,15 @@ socket_accept_client(int accepting_socket)
return -1;
}
/* Performance tuning. Turn off Nagle's algorithm.
* Otherwise, when the servers sends a reply to the client, and the reply
* is small relative to the MSS size, there would be a delay of 40ms
* during which the OS would hope in vain for more data to be sent.
* See tcp(7)
*/
int i = 1;
setsockopt(client, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i));
/* The following will help with debugging your server.
* Adjust and/or remove as you see fit.
*/