Spring 2020 version
This commit is contained in:
parent
650c2dd851
commit
cd09eb1954
@ -4,6 +4,11 @@
|
|||||||
# Run this script to install the required Jansson and JWT packages.
|
# Run this script to install the required Jansson and JWT packages.
|
||||||
#
|
#
|
||||||
BASE=`pwd`
|
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
|
test -d ${BASE}/deps || mkdir ${BASE}/deps
|
||||||
git clone https://github.com/akheron/jansson.git
|
git clone https://github.com/akheron/jansson.git
|
||||||
(cd jansson;
|
(cd jansson;
|
||||||
|
@ -22,4 +22,4 @@ server: $(OBJ)
|
|||||||
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
|
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm $(OBJ) $(OTHERS)
|
/bin/rm -f $(OBJ) $(OTHERS) server
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
|
||||||
struct bufio;
|
struct bufio; // opaque type
|
||||||
|
// users should interact only via the public functions below
|
||||||
struct bufio * bufio_create(int socket);
|
struct bufio * bufio_create(int socket);
|
||||||
void bufio_close(struct bufio * self);
|
void bufio_close(struct bufio * self);
|
||||||
void bufio_truncate(struct bufio * self);
|
void bufio_truncate(struct bufio * self);
|
||||||
|
@ -74,6 +74,7 @@ main(int ac, char *av[])
|
|||||||
|
|
||||||
case 'e':
|
case 'e':
|
||||||
token_expiration_time = atoi(optarg);
|
token_expiration_time = atoi(optarg);
|
||||||
|
fprintf(stderr, "token expiration time is %d\n", token_expiration_time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
|
10
src/socket.c
10
src/socket.c
@ -13,6 +13,7 @@
|
|||||||
#include <sys/sendfile.h>
|
#include <sys/sendfile.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -127,6 +128,15 @@ socket_accept_client(int accepting_socket)
|
|||||||
return -1;
|
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.
|
/* The following will help with debugging your server.
|
||||||
* Adjust and/or remove as you see fit.
|
* Adjust and/or remove as you see fit.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user