/* [<][>][^][v][top][bottom][index][help] */
1 #pragma once
2 #ifndef SSHDRAINER_H
3 #define SSHDRAINER_H
4
5 #include "dmtcpalloc.h"
6 #include "../jalib/jsocket.h"
7
8 namespace dmtcp
9 {
10
11 class SSHDrainer : public jalib::JMultiSocketProgram
12 {
13 public:
14 SSHDrainer() : _timeoutCount(0) {}
15 static SSHDrainer& instance();
16
17 void beginDrainOf(int fd, int refillfd = -1);
18 void refill();
19 virtual void onData(jalib::JReaderInterface* sock);
20 virtual void onConnect(const jalib::JSocket&, const struct sockaddr*,
21 socklen_t remoteLen);
22 virtual void onTimeoutInterval();
23 virtual void onDisconnect(jalib::JReaderInterface* sock);
24
25 private:
26 map<int, vector<char> > _drainedData;
27 map<int, int> _refillFd;
28 int _timeoutCount;
29 };
30
31 }
32
33 #endif