Skip to content

Commit 7efc228

Browse files
jwoldanMatt Oakes
authored and
Matt Oakes
committed
Updated socket.php to timeout on long sends
1 parent 6861e1a commit 7efc228

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lastfmapi/class/socket.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ function lastfmApiSocket ($host, $port) {
6464
* @return string|array
6565
*/
6666
function send ($msg, $type = '') {
67+
// Set a short timeout to prevent long hangs
68+
stream_set_timeout($this->handle, 2);
6769
// Send message over connection
6870
fwrite($this->handle, $msg);
6971

0 commit comments

Comments
 (0)