diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-10-22 23:14:26 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-10-22 23:56:02 +0200 |
commit | d41187bbf6a06e2d5d9554964bf6f3654bc6d503 (patch) | |
tree | f73bfce3b61f33377f1aac063395d9501e832a76 /src | |
parent | daq: updated readme (diff) |
daq: accesslog now uses stateless protocol
Diffstat (limited to 'src')
-rwxr-xr-x | src/daq/accesslog/s5-accesslog | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/daq/accesslog/s5-accesslog b/src/daq/accesslog/s5-accesslog index e3d846f..78c7f36 100755 --- a/src/daq/accesslog/s5-accesslog +++ b/src/daq/accesslog/s5-accesslog @@ -306,7 +306,7 @@ class AccessLog(): for c in self._streamer.keys(): for f in self._streamer[c].keys(): for q in self._streamer[c][f].keys(): - self._sendDataset(ts, self._duration, c, f, q) + self._sendDatasetFull(ts, self._duration, c, f, q) cnt +=1 return cnt @@ -327,7 +327,8 @@ class AccessLog(): def socketReady(self): print 'SFive: connection to sfive hub established' self._connected = True - self._sendInit() +# we are using datagram sockets for now -> must use stateless protocol +# self._sendInit() updatecnt, linecnt = self._sendLogData() print 'SFive: imported %d datasets from %d lines' % (updatecnt, linecnt) self._fd.close() @@ -342,6 +343,24 @@ class AccessLog(): if reactor.running: reactor.stop() + def _sendDatasetFull(self, timestamp, duration, content_id, format, quality): + clients = self._streamer[content_id][format][quality] + data = { "version": 1, "hostname": self._hostname, "tags": self._tags, + "streamer-id": { + "content-id": content_id, + "format": format, + "quality": quality + }, + "start-time": timestamp.isoformat('T') + 'Z', + "duration-ms": duration * 1000, + "data": { + "clients": list(clients.values()), + "client-count": clients.getCnt(), + "bytes-sent": clients.getBytesSent() + } + } + self._proto.sendDatagram('%s\n' % (json.dumps(data))); + def _sendInit(self): initdata = { "version": 1, "hostname": self._hostname, "streamer-id" : { }, |