http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97328

Revision: 97328
Author:   reedy
Date:     2011-09-16 20:08:33 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Noticed in apache error logs (see below). If the length of the message is 
longer than the maximum length, only send what will fit

Sep 16 20:07:28 10.0.2.193 apache2[28441]: PHP Warning:  socket_sendto() [<a 
href='function.socket-sendto'>function.socket-sendto</a>]: unable to write to 
socket [90]: Message too long in 
/home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464
Sep 16 20:07:29 10.0.2.193 apache2[26511]: PHP Warning:  socket_sendto() [<a 
href='function.socket-sendto'>function.socket-sendto</a>]: unable to write to 
socket [90]: Message too long in 
/home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464

Modified Paths:
--------------
    trunk/phase3/includes/GlobalFunctions.php

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2011-09-16 19:39:53 UTC (rev 
97327)
+++ trunk/phase3/includes/GlobalFunctions.php   2011-09-16 20:08:33 UTC (rev 
97328)
@@ -867,7 +867,14 @@
                if ( !$sock ) {
                        return;
                }
-               socket_sendto( $sock, $text, strlen( $text ), 0, $host, $port );
+
+               $len = strlen( $text );
+               $maxLen = socket_get_option( $sock, SOL_UDP, SO_SNDBUF );
+
+               if ( $len > $maxLen ) {
+                       $len = $maxLen - 1;
+               }
+               socket_sendto( $sock, $text, $len, 0, $host, $port );
                socket_close( $sock );
        } else {
                wfSuppressWarnings();


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to