blob: e239e196837a2f27a8fab65dd8fd64bfdb97963e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef KV_SERVER_TCP
#define KV_SERVER_TCP
#include <netinet/in.h>
#include <pthread.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <unistd.h>
#include <packet.h>
#include "channel.h"
#include <container.h>
#include <rstypes.h>
#define TCP_PORT 8085
#define LISTEN_AMOUNT 128
#define TCP_MAX_WAIT_MS 10
#define TCP_MAX_RETRIES 0
#define ADMIN_UID 0
/* val: struct tcp_channel */
extern struct hash_set channels;
/* val: struct tcp_user */
extern struct hash_set users;
void print_state(int);
void exit_tcp(int);
void tcp_loop(void);
u64 spawn_channel(struct thread_loop_arg *arg);
u64 spawn_channel_pool(void* arg); // TODO
bool sendto_channel(size_t chid, struct kv_system_packet* packet, int wait_ack_ms, int repeat);
#endif // KV_SERVER_TCP
|