blob: 587b2c4fdb0429ef043176fd843a002b93d22f75 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef EDITOR_FILE_SERVER_H
#define EDITOR_FILE_SERVER_H
#include "object.h"
#include "os/thread.h"
#include "io/tcp_server.h"
#include "io/packet_peer.h"
#include "io/file_access_network.h"
class EditorFileServer : public Object {
OBJ_TYPE(EditorFileServer,Object);
enum Command {
CMD_NONE,
CMD_ACTIVATE,
CMD_STOP,
};
struct ClientData {
Thread *thread;
Ref<StreamPeerTCP> connection;
Map<int,FileAccess*> files;
EditorFileServer *efs;
bool quit;
};
Ref<TCP_Server> server;
Set<Thread*> to_wait;
static void _close_client(ClientData *cd);
static void _subthread_start(void*s);
Mutex *wait_mutex;
Thread *thread;
static void _thread_start(void*);
bool quit;
Command cmd;
String password;
int port;
bool active;
public:
void start();
void stop();
bool is_active() const;
EditorFileServer();
~EditorFileServer();
};
#endif // EDITOR_FILE_SERVER_H
|