Permalink
Browse files

Docs

  • Loading branch information...
1 parent b572fcf commit 7ee7b85b36d49b240841025eb5cc1858f4c56657 @kakserpom committed Mar 20, 2013
Showing with 21 additions and 2 deletions.
  1. +20 −1 lib/ShmEntity.php
  2. +1 −1 lib/WebSocketProtocolV13.php
View
21 lib/ShmEntity.php
@@ -73,23 +73,42 @@ public function open($segno = 0, $create = false) {
return $shm;
}
+ /**
+ * Get open segments
+ * @return array
+ */
public function getSegments() {
return $this->segments;
}
+
+ /**
+ * Open all segments
+ * @return void
+ */
public function openall() {
do {
$r = $this->open(sizeof($this->segments));
} while ($r);
}
- public function write($data, $offset) {
+ /**
+ * Write to shared memory
+ * @param string Data
+ * @param integer Offset
+ * @return void
+ */
+ public function write($data, $offset) { // @TODO: prevent overflow
$segno = floor($offset / $this->segsize);
if (!isset($this->segments[$segno])) {
$this->open($segno, true);
}
shmop_write($this->segments[$segno], $data, $offset % $this->segsize);
}
+ /**
+ * Deletes all segments
+ * @return void
+ */
public function delete() {
foreach ($this->segments as $shm) {
shmop_delete($shm);
View
2 lib/WebSocketProtocolV13.php
@@ -268,4 +268,4 @@ public function onRead() {
}
}
}
-}
+}

0 comments on commit 7ee7b85

Please sign in to comment.