[Spread-cvs] commit: r470 - trunk/perl/Spread

jonathan at spread.org jonathan at spread.org
Tue Jan 31 00:37:18 EST 2012


Author: jonathan
Date: 2012-01-31 00:37:18 -0500 (Tue, 31 Jan 2012)
New Revision: 470

Modified:
   trunk/perl/Spread/Makefile.PL
   trunk/perl/Spread/README
   trunk/perl/Spread/Spread.pm
   trunk/perl/Spread/Spread.xs
Log:
Update Perl bindings to 3.17.4.4 release from CPAN

Modified: trunk/perl/Spread/Makefile.PL
===================================================================
--- trunk/perl/Spread/Makefile.PL	2012-01-31 05:26:05 UTC (rev 469)
+++ trunk/perl/Spread/Makefile.PL	2012-01-31 05:37:18 UTC (rev 470)
@@ -2,8 +2,8 @@
 use ExtUtils::MakeMaker 5.16 ;
 use Config ;
 
-$SPLIB_LIB = '-L../.. -L../spread-src-3.17.0/' ;
-$SPLIB_INCLUDE = '-I ../.. -I ../spread-src-3.17.0/' ;
+$SPLIB_LIB = $ENV{'SPLIB_LIB'} || '-L../.. -L../spread-src-3.17.0/' ;
+$SPLIB_INCLUDE = $ENV{'SPLIB_INCLUDE'} || '-I ../.. -I ../spread-src-3.17.0/' ;
 
 WriteMakefile(
 	NAME		=> 'Spread',

Modified: trunk/perl/Spread/README
===================================================================
--- trunk/perl/Spread/README	2012-01-31 05:26:05 UTC (rev 469)
+++ trunk/perl/Spread/README	2012-01-31 05:37:18 UTC (rev 470)
@@ -1,11 +1,11 @@
-Spread-3.15.2 Version 1.04
+Spread-3.17.4.4
 =====================
 
 DESCRIPTION
 -----------
 
-Spread-3.15.2-1.04 is a Perl module that conveniently wraps the Spread C
-libraries provided with the Spread 3.15.2 distribution.  Spread is available at
+Spread-3.17.4.4 is a Perl module that conveniently wraps the Spread C
+libraries provided with the Spread 3.17.4 distribution.  Spread is available at
 http://www.spread.org/.  Spread is a local/wide area group communication
 toolkit that runs on most modern operating systems.  It allows convenient
 mechanisms for reliable multicasting information between applications as well
@@ -14,6 +14,29 @@
 CHANGES
 -------
 
+Version 3.17.4.4 fixes documentation about $sperrno and a possible short
+copy of group name in multigroup multicast. Add processing of SPLIB_LIB
+and SPLIB_INCLUDE environment variables to ease makefile generation.  Fixed
+a few compiler warnings.
+
+Version 3.17.4.3 fixes an unsafe pass of the spread version string as a
+printf format string.  Thanks Jerome Quelin.
+
+Version 3.17.4.2 fix typo in receive that prevented receiving messages
+spent to more than 64 groups.  Also adds REJECT_AUTH error code.
+Thanks Martin.
+
+Version 3.17.4.1 add REJECT_MESS, remove _ from version.
+
+Version 3.17.3_108 fix version to make MakeMaker happier.
+
+Version 3.17.3-1.07 fix man pages and exports.
+
+Version 3.17.3-1.06 differentiate between select timeout and other failures.
+Thanks to Matt Sergeant.
+
+Version 3.17.1-1.05 fixes a service_type error (uninitialized variable)
+
 Version 3.15.2-1.04 adds a MANFIEST, dist to Makefile.PL, and several spelling
 corrections.  The only used code change was the spelling correction of CAUSAL.
 
@@ -27,13 +50,13 @@
 PREREQUISITES
 -------------
 
-Spread-3.15.2-1.04 requires the Spread group communication toolkit daemon and
+Spread-3.17.4.1 requires the Spread group communication toolkit daemon and
 client C libraries (with headers) to be installed (or compiled) on the system.
 
 It will often not work correctly if there is an older libsp installed on the
 system.
 
-It also request Perl 5.
+It also requires Perl 5.
 
 INSTALLATION
 ------------
@@ -46,7 +69,7 @@
 COPYRIGHT AND DISCLAIMER
 ------------------------
 
-Copyright (c) 2000,2001 Theo Schlossnagle <jesus at cnds.jhu.edu>
+Copyright (c) 2000-2006,2008 Theo Schlossnagle <jesus at lethargy.org>
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: trunk/perl/Spread/Spread.pm
===================================================================
--- trunk/perl/Spread/Spread.pm	2012-01-31 05:26:05 UTC (rev 469)
+++ trunk/perl/Spread/Spread.pm	2012-01-31 05:37:18 UTC (rev 470)
@@ -1,9 +1,8 @@
 # Filename: Spread.pm
 # Author:   Theo Schlossnagle <jesus at cnds.jhu.edu>
 # Created:  12th October 1999
-# Version:  1.03152
 #
-# Copyright (c) 1999-2001 Theo Schlossnagle. All rights reserved.
+# Copyright (c) 1999-2006,2008 Theo Schlossnagle. All rights reserved.
 #   This program is free software; you can redistribute it and/or
 #   modify it under the same terms as Perl itself.
 #
@@ -20,7 +19,7 @@
 use strict;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
 
-$VERSION = "3.17.0-1.04" ;
+$VERSION = "3.17.4.4" ;
 
 *SP_connect = \&Spread::connect;
 *SP_disconnect = \&Spread::disconnect;
@@ -52,7 +51,8 @@
 			     CAUSED_BY_LEAVE
 			     CAUSED_BY_DISCONNECT
 			     CAUSED_BY_NETWORK
-			     MEMBERSHIP_MESS) ],
+			     MEMBERSHIP_MESS
+			     REJECT_MESS) ],
 		ERROR => [ qw($sperrno
 			      ACCEPT_SESSION
 			      ILLEGAL_GROUP
@@ -71,7 +71,7 @@
 			      REJECT_QUOTA
 			      REJECT_VERSION) ],
 		SP => [ qw(SP_connect
-			   SP_disconnecct
+			   SP_disconnect
 			   SP_join
 			   SP_leave
 			   SP_receive
@@ -101,6 +101,7 @@
 	     CAUSED_BY_DISCONNECT
 	     CAUSED_BY_NETWORK
 	     MEMBERSHIP_MESS
+	     REJECT_MESS
 	     
 	     ACCEPT_SESSION
 	     ILLEGAL_GROUP
@@ -120,7 +121,7 @@
 	     REJECT_VERSION
 	     
 	     SP_connect
-	     SP_disconnecct
+	     SP_disconnect
 	     SP_join
 	     SP_leave
 	     SP_receive
@@ -165,8 +166,6 @@
 1;
 __END__
 
-# Below is the stub of documentation for your module. You better edit it!
-
 =head1 NAME
 
 Spread - Perl extension for the Spread group communication system
@@ -176,15 +175,21 @@
   use Spread;
 
   # Connect
-  my($mailbox, $private_group) = Spread::connect(
+  my($mbox, $private_group) = Spread::connect( {
 	spread_name => '4444 at host.domain.com',
 	private_name => 'mrcool',
-	);
+	} );
 
+  # If you don't give a private name, you'll get a unique name from the spread daemon.
+  my($mailbox, $private_group) = Spread::connect(
+    spread_name => '4444 at host.domain.com',
+  );
+
+
   # Join and leave groups
   my(@group_to_join) = ( 'GroupA', 'GroupB', 'GroupC' );
   my(@joined_groups) = grep( Spread::join($mbox, $_), @group_to_join );
-  print "Spread::join -- $sperrorno"
+  print "Spread::join -- $sperrno"
   	unless (Spread::leave($mbox, 'GroupC'));
 
   # Multicast to group(s)
@@ -204,7 +209,7 @@
 
   # Disconnect
   if(Spread::disconnect($mbox)) { print "Successful disconnect\n"; }
-  else { print "Spread::disconnect -- $sperrorno\n"; }
+  else { print "Spread::disconnect -- $sperrno\n"; }
 
 =head1 DESCRIPTION
 
@@ -213,8 +218,8 @@
 See man pages for SP_connect, SP_join, SP_multicast, SP_receive,
 SP_poll, SP_error, SP_leave, SP_disconnect.
 
-$sperror holds either the integer spread error or a descriptive string
-depending on the context in which $sperror is used.
+$sperrno holds either the integer spread error or a descriptive string
+depending on the context in which $sperrno is used.
 
 =head1 Exported constants
 
@@ -268,6 +273,7 @@
   REGULAR_MESS
   REG_MEMB_MESS
   REJECT_ILLEGAL_NAME
+  REJECT_MESS
   REJECT_NOT_UNIQUE
   REJECT_NO_NAME
   REJECT_QUOTA

Modified: trunk/perl/Spread/Spread.xs
===================================================================
--- trunk/perl/Spread/Spread.xs	2012-01-31 05:26:05 UTC (rev 469)
+++ trunk/perl/Spread/Spread.xs	2012-01-31 05:37:18 UTC (rev 470)
@@ -1,9 +1,8 @@
 /* Filename: Spread.xs
  * Author:   Theo Schlossnagle <jesus at cnds.jhu.edu>
  * Created:  12th October 1999
- * Version:  1.03152
  *
- * Copyright (c) 1999-2001 Theo Schlossnagle. All rights reserved.
+ * Copyright (c) 1999-2006,2008 Theo Schlossnagle. All rights reserved.
  *   This program is free software; you can redistribute it and/or
  *   modify it under the same terms as Perl itself.
  *
@@ -37,9 +36,12 @@
 
 
 #define SPERRNO "Spread::sperrno"
+#define MAX_ERRMSG     4
+#define SELECT_FAILED  4
 #define SELECT_TIMEOUT 3
 #define ARGS_INSUFF 2
 static char *my_e_errmsg[] = {
+ "Select Failed",       /* SELECT_FAILED        4 */
  "Select Timed Out",	/* SELECT_TIMEOUT		3 */
  "Insufficient Arguments", /* ARGS_INSUFF		2 */
  "Accept Session",	/* ACCEPT_SESSION		1 */
@@ -52,20 +54,20 @@
  "Reject: Not Unique",	/* REJECT_NOT_UNIQUE		-6 */
  "Reject: Version",	/* REJECT_VERSION		-7 */
  "Connection Closed",	/* CONNECTION_CLOSED		-8 */
- ""		,	/*				-9 */
+ "Reject: Auth",	/* REJECT_AUTH			-9 */
  ""		,	/*				-10 */
  "Illegal Session",	/* ILLEGAL_SESSION		-11 */
  "Illegal Service",	/* ILLEGAL_SERVICE		-12 */
  "Illegal Message",	/* ILLEGAL_MESSAGE		-13 */
  "Illegal Group",	/* ILLEGAL_GROUP		-14 */
  "Buffer Too Short",	/* BUFFER_TOO_SHORT		-15 */
-#ifdef GROUP_TOO_SHORT
+#ifdef GROUPS_TOO_SHORT
  "Groups Too Short",	/* GROUPS_TOO_SHORT		-16 */
 #endif
 #ifdef MESSAGE_TOO_LONG
  "Message Too Long",	/* MESSAGE_TOO_LONG		-17 */
 #else
-#error You must install spread 3.17.0 client libraries to build perl Spread.
+#error You must install spread client libraries to build perl Spread.
 #endif
  ""};
 static char *connect_params[] = {
@@ -284,12 +286,24 @@
 #else
             goto not_there;
 #endif
+        if (strEQ(name, "REJECT_AUTH"))
+#ifdef REJECT_AUTH
+            return REJECT_AUTH;
+#else
+            goto not_there;
+#endif
         if (strEQ(name, "REJECT_ILLEGAL_NAME"))
 #ifdef REJECT_ILLEGAL_NAME
             return REJECT_ILLEGAL_NAME;
 #else
             goto not_there;
 #endif
+        if (strEQ(name, "REJECT_MESS"))
+#ifdef REJECT_MESS
+            return REJECT_MESS;
+#else
+            goto not_there;
+#endif
         if (strEQ(name, "REJECT_NOT_UNIQUE"))
 #ifdef REJECT_NOT_UNIQUE
             return REJECT_NOT_UNIQUE;
@@ -429,7 +443,7 @@
 	char * errstr ;
 	SV * sperror_sv = perl_get_sv(SPERRNO, FALSE);
 
-	errstr = (char *) my_e_errmsg[3 - error_no];
+	errstr = (char *) my_e_errmsg[MAX_ERRMSG - error_no];
 	if (SvIV(sperror_sv) != error_no) {
 	  sv_setiv(sperror_sv, error_no) ;
 	  sv_setpv(sperror_sv, errstr) ;
@@ -460,7 +474,7 @@
 	if(SP_version(&major, &minor, &patch) <= 0 ||
 	   major<3 || (major==3 && minor<15) ||
 	   (major==3 && minor==15 && patch<1))
-	  croak(SPversionstr()) ; 
+	  croak("%s", SPversionstr()) ; 
 
 	{
 	  SV * sperror_sv = perl_get_sv(SPERRNO, GV_ADDMULTI) ;
@@ -587,7 +601,8 @@
 	CODE:
 	{
 	  int mbox = SvIV(svmbox);
-	  int mlength, i, ret, ngroups=0;
+	  int i, ret, ngroups=0;
+          size_t mlength;
 	  char *groupname;
 	  char *message;
 	/* It is OK to use NULL.. We only see this, it isn't returned */
@@ -607,12 +622,12 @@
 	      }
 	      for(i=0;i<ngroups;i++) {
 		char *string;
-		int slength;
+		size_t slength;
 		SV **afetch = av_fetch(groups, i, FALSE);
 		string = SvPV(*afetch, slength);
 		strncpy(&groupnames[i*MAX_GROUP_NAME],
 			string,
-			MIN(MAX_GROUP_NAME,slength));
+			MAX_GROUP_NAME);
 	      }
 	    } else if(SvTYPE(group = SvRV(svgroups))==SVt_PV) {
 	      groupname = SvPV(group, PL_na);
@@ -660,7 +675,7 @@
 	  static int oldmsize=0, newmsize=(1<<15); /* 65k */
 	  int i, mbox, endmis, ret, ngrps, msize;
 	  int16 mtype;
-	  service stype;
+	  service stype = 0;
 	  struct timeval towait;
 	  static char *groups=NULL;
 	  static char *mess=NULL;
@@ -687,7 +702,7 @@
 	    FD_ZERO(&readfs); FD_SET(mbox, &readfs);
 	    if((ret = select(mbox+1, &readfs, NULL, &readfs, &towait))!=1) {
 	      STYPE=SENDER=MTYPE=ENDMIS=MESSAGE=&PL_sv_undef;
-	      SetSpErrorNo(SELECT_TIMEOUT);
+	      SetSpErrorNo( ret == 0 ? SELECT_TIMEOUT : SELECT_FAILED );
 	      goto rec_ending;
 	    }
 	  }
@@ -717,7 +732,7 @@
 		  goto try_again;
 #ifdef GROUPS_TOO_SHORT
 		} else if (ret==GROUPS_TOO_SHORT) {
-		  newgsize=--ngrps;
+		  newgsize=-ngrps;
 		  ERROR = newSViv(GROUPS_TOO_SHORT);
 		  ngrps = oldgsize;
 		  goto try_again;




More information about the Spread-cvs mailing list