summaryrefslogtreecommitdiff
path: root/src/daq
diff options
context:
space:
mode:
Diffstat (limited to 'src/daq')
-rwxr-xr-xsrc/daq/accesslog/s5-accesslog23
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" : { },