Create TCPSession2 for outpubound connections.
This commit is contained in:
1 parent
5c87225c6f
commit
fd70c79282
129 files changed
+1902
-710
No files matched your search
+27
-26
@@ -1,17 +1,18 @@
|
||||
#include "INotify.h"
|
||||
#include "Log.h"
|
||||
#include "ZString.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
|
||||
INotify::INotify(EPoll &ePoll) : Socket(ePoll, "INotify") {
|
||||
setDescriptor(inotify_init());
|
||||
}
|
||||
|
||||
setDescriptor(inotify_init());
|
||||
}
|
||||
|
||||
INotify::~INotify() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
int INotify::addWatch(std::string watch) {
|
||||
|
||||
int INotify::addWatch(coreutils::ZString &watch) {
|
||||
return inotify_add_watch(getDescriptor(), watch.c_str(), IN_ALL_EVENTS);
|
||||
}
|
||||
|
||||
@@ -22,37 +23,37 @@ namespace core {
|
||||
void INotify::onDataReceived(coreutils::ZString &buffer) {
|
||||
const struct inotify_event *event;
|
||||
char *ptr;
|
||||
for (ptr = buffer.getData(); ptr < buffer.getData() + buffer.getLength();
|
||||
for (ptr = buffer.getData();
|
||||
ptr < buffer.getData() + buffer.getLength();
|
||||
ptr += sizeof(struct inotify_event) + event->len) {
|
||||
event = (const struct inotify_event *) ptr;
|
||||
|
||||
if(event->mask & IN_ACCESS)
|
||||
inAccess(std::string(event->name));
|
||||
if(event->mask & IN_ATTRIB)
|
||||
coreutils::ZString name(event->name);
|
||||
|
||||
if(event->mask & IN_ACCESS)
|
||||
inAccess(name);
|
||||
if(event->mask & IN_ATTRIB)
|
||||
inAttrib(std::string(event->name));
|
||||
if(event->mask & IN_CLOSE_WRITE)
|
||||
if(event->mask & IN_CLOSE_WRITE)
|
||||
inCloseWrite(std::string(event->name));
|
||||
if(event->mask & IN_CLOSE_NOWRITE)
|
||||
if(event->mask & IN_CLOSE_NOWRITE)
|
||||
inCloseNoWrite(std::string(event->name));
|
||||
if(event->mask & IN_CREATE)
|
||||
inCreate(std::string(event->name));
|
||||
if(event->mask & IN_DELETE)
|
||||
if(event->mask & IN_CREATE)
|
||||
inCreate(name);
|
||||
if(event->mask & IN_DELETE)
|
||||
inDelete(std::string(event->name));
|
||||
if(event->mask & IN_DELETE_SELF)
|
||||
if(event->mask & IN_DELETE_SELF)
|
||||
inDeleteSelf(std::string(event->name));
|
||||
if(event->mask & IN_MODIFY)
|
||||
if(event->mask & IN_MODIFY)
|
||||
inModify(std::string(event->name));
|
||||
if(event->mask & IN_MOVE_SELF)
|
||||
if(event->mask & IN_MOVE_SELF)
|
||||
inMoveSelf(std::string(event->name));
|
||||
if(event->mask & IN_MOVED_FROM)
|
||||
if(event->mask & IN_MOVED_FROM)
|
||||
inMovedFrom(std::string(event->name));
|
||||
if(event->mask & IN_MOVED_TO)
|
||||
if(event->mask & IN_MOVED_TO)
|
||||
inMovedTo(std::string(event->name));
|
||||
if(event->mask & IN_OPEN)
|
||||
if(event->mask & IN_OPEN)
|
||||
inOpen(std::string(event->name));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user