[debian-edu-commits] debian-edu/pkg-team/ 01/01: Fixed sync-socket.patch

Javier Serrano Polo jasp00-guest at moszumanska.debian.org
Wed Apr 27 19:02:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

jasp00-guest pushed a commit to branch master
in repository lmms.

commit cf97b8ae91cc4b748585e5b13b26404489a324af
Author: Javier Serrano Polo <javier at jasp.net>
Date:   Wed Apr 27 21:00:20 2016 +0200

    Fixed sync-socket.patch
---
 debian/patches/sync-socket.patch | 96 ++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 47 deletions(-)

diff --git a/debian/patches/sync-socket.patch b/debian/patches/sync-socket.patch
index 444dbbf..86c644c 100644
--- a/debian/patches/sync-socket.patch
+++ b/debian/patches/sync-socket.patch
@@ -6,7 +6,7 @@ Author: Javier Serrano Polo <javier at jasp.net>
 Index: lmms-1.1.3/include/RemotePlugin.h
 ===================================================================
 --- lmms-1.1.3.orig/include/RemotePlugin.h	2016-04-14 22:36:18.000000000 +0200
-+++ lmms-1.1.3/include/RemotePlugin.h	2016-04-20 01:38:51.000000000 +0200
++++ lmms-1.1.3/include/RemotePlugin.h	2016-04-27 19:05:38.000000000 +0200
 @@ -37,11 +37,13 @@
  #include <cassert>
  
@@ -356,7 +356,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	inline const shmFifo * in() const
  	{
  		return m_in;
-@@ -652,18 +654,93 @@
+@@ -652,18 +654,85 @@
  	{
  		return m_out;
  	}
@@ -406,12 +406,8 @@ Index: lmms-1.1.3/include/RemotePlugin.h
 +					memset( _buf, 0, _len );
 +					return;
 +			}
++			buf += nread;
 +			remaining -= nread;
-+			if ( remaining )
-+			{
-+				buf += nread;
-+				sched_yield();
-+			}
 +		}
 +	}
 +
@@ -435,12 +431,8 @@ Index: lmms-1.1.3/include/RemotePlugin.h
 +					invalidate();
 +					return;
 +			}
++			buf += nwritten;
 +			remaining -= nwritten;
-+			if ( remaining )
-+			{
-+				buf += nwritten;
-+				sched_yield();
-+			}
 +		}
 +	}
 +
@@ -450,7 +442,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  
  } ;
  
-@@ -697,8 +774,9 @@
+@@ -697,8 +766,9 @@
  } ;
  
  
@@ -461,7 +453,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  public:
  	RemotePlugin();
  	virtual ~RemotePlugin();
-@@ -797,7 +875,16 @@
+@@ -797,7 +867,16 @@
  	int m_inputCount;
  	int m_outputCount;
  
@@ -478,7 +470,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  } ;
  
  #endif
-@@ -808,7 +895,11 @@
+@@ -808,7 +887,11 @@
  class RemotePluginClient : public RemotePluginBase
  {
  public:
@@ -490,7 +482,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	virtual ~RemotePluginClient();
  #ifdef USE_QT_SHMEM
  	VstSyncData * getQtVSTshm();
-@@ -905,9 +996,15 @@
+@@ -905,9 +988,15 @@
  #endif
  
  
@@ -506,7 +498,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  {
  #ifdef LMMS_HAVE_LOCALE_H
  	// make sure, we're using common ways to print/scan
-@@ -921,8 +1018,10 @@
+@@ -921,8 +1010,10 @@
  
  RemotePluginBase::~RemotePluginBase()
  {
@@ -517,7 +509,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  }
  
  
-@@ -930,6 +1029,7 @@
+@@ -930,6 +1021,7 @@
  
  int RemotePluginBase::sendMessage( const message & _m )
  {
@@ -525,7 +517,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	m_out->lock();
  	m_out->writeInt( _m.id );
  	m_out->writeInt( _m.data.size() );
-@@ -941,6 +1041,16 @@
+@@ -941,6 +1033,16 @@
  	}
  	m_out->unlock();
  	m_out->messageSent();
@@ -542,7 +534,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  
  	return j;
  }
-@@ -950,6 +1060,7 @@
+@@ -950,6 +1052,7 @@
  
  RemotePluginBase::message RemotePluginBase::receiveMessage()
  {
@@ -550,7 +542,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	m_in->waitForMessage();
  	m_in->lock();
  	message m;
-@@ -960,6 +1071,15 @@
+@@ -960,6 +1063,15 @@
  		m.data.push_back( m_in->readString() );
  	}
  	m_in->unlock();
@@ -566,7 +558,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	return m;
  }
  
-@@ -1005,8 +1125,13 @@
+@@ -1005,8 +1117,13 @@
  #ifdef BUILD_REMOTE_PLUGIN_CLIENT
  
  
@@ -580,7 +572,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  #ifdef USE_QT_SHMEM
  	m_shmObj(),
  	m_shmQtID( "/usr/bin/lmms" ),
-@@ -1062,6 +1187,28 @@
+@@ -1062,6 +1179,31 @@
  		}
  	}
  #endif
@@ -589,11 +581,14 @@ Index: lmms-1.1.3/include/RemotePlugin.h
 +	struct sockaddr_un sa;
 +	sa.sun_family = AF_LOCAL;
 +
-+	if ( strlen( socketPath ) >= sizeof sa.sun_path )
++	size_t length = strlen( socketPath );
++	if ( length >= sizeof sa.sun_path )
 +	{
++		length = sizeof sa.sun_path - 1;
 +		fprintf( stderr, "Socket path too long.\n" );
 +	}
-+	strcpy( sa.sun_path, socketPath );
++	memcpy( sa.sun_path, socketPath, length );
++	sa.sun_path[length] = '\0';
 +
 +	m_socket = socket( PF_LOCAL, SOCK_STREAM, 0 );
 +	if ( m_socket == -1 )
@@ -609,7 +604,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
  	// if attaching shared memory fails
  	sendMessage( IdSampleRateInformation );
  	sendMessage( IdBufferSizeInformation );
-@@ -1080,6 +1227,13 @@
+@@ -1080,6 +1222,13 @@
  #ifndef USE_QT_SHMEM
  	shmdt( m_shm );
  #endif
@@ -626,7 +621,7 @@ Index: lmms-1.1.3/include/RemotePlugin.h
 Index: lmms-1.1.3/plugins/vst_base/RemoteVstPlugin.cpp
 ===================================================================
 --- lmms-1.1.3.orig/plugins/vst_base/RemoteVstPlugin.cpp	2016-04-14 22:36:18.000000000 +0200
-+++ lmms-1.1.3/plugins/vst_base/RemoteVstPlugin.cpp	2016-04-20 01:43:34.000000000 +0200
++++ lmms-1.1.3/plugins/vst_base/RemoteVstPlugin.cpp	2016-04-27 16:02:49.000000000 +0200
 @@ -56,6 +56,7 @@
  
  #endif
@@ -803,7 +798,7 @@ Index: lmms-1.1.3/plugins/zynaddsubfx/ZynAddSubFx.h
 Index: lmms-1.1.3/src/core/RemotePlugin.cpp
 ===================================================================
 --- lmms-1.1.3.orig/src/core/RemotePlugin.cpp	2016-04-14 22:36:18.000000000 +0200
-+++ lmms-1.1.3/src/core/RemotePlugin.cpp	2016-04-20 17:25:13.000000000 +0200
++++ lmms-1.1.3/src/core/RemotePlugin.cpp	2016-04-27 20:39:42.000000000 +0200
 @@ -39,6 +39,12 @@
  #include <unistd.h>
  #endif
@@ -830,7 +825,7 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
  	m_failed( true ),
  	m_process(),
  	m_watcher( this ),
-@@ -85,6 +96,30 @@
+@@ -85,6 +96,34 @@
  	m_inputCount( DEFAULT_CHANNELS ),
  	m_outputCount( DEFAULT_CHANNELS )
  {
@@ -841,12 +836,16 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
 +	m_socketFile = QDir::tempPath() + QDir::separator() +
 +						QUuid::createUuid().toString();
 +	const char * path = m_socketFile.toUtf8().constData();
-+	if ( strlen( path ) >= sizeof sa.sun_path )
++	size_t length = strlen( path );
++	if ( length >= sizeof sa.sun_path )
 +	{
++		length = sizeof sa.sun_path - 1;
 +		qWarning( "Socket path too long." );
 +	}
-+	strcpy( sa.sun_path, path );
-+	m_server = socket( PF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0 );
++	memcpy( sa.sun_path, path, length );
++	sa.sun_path[length] = '\0';
++
++	m_server = socket( PF_LOCAL, SOCK_STREAM, 0 );
 +	if ( m_server == -1 )
 +	{
 +		qWarning( "Unable to start the server." );
@@ -861,7 +860,7 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
  }
  
  
-@@ -116,6 +151,14 @@
+@@ -116,6 +155,14 @@
  		shmctl( m_shmID, IPC_RMID, NULL );
  #endif
  	}
@@ -876,7 +875,7 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
  }
  
  
-@@ -127,16 +170,22 @@
+@@ -127,16 +174,22 @@
  	lock();
  	if( m_failed )
  	{
@@ -899,7 +898,7 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
  #ifndef DEBUG_REMOTE_PLUGIN
  	m_process.setProcessChannelMode( QProcess::ForwardedChannels );
  	m_process.setWorkingDirectory( QCoreApplication::applicationDirPath() );
-@@ -146,6 +195,30 @@
+@@ -146,6 +199,33 @@
  	qDebug() << exec << args;
  #endif
  
@@ -911,26 +910,29 @@ Index: lmms-1.1.3/src/core/RemotePlugin.cpp
 +	pollin.fd = m_server;
 +	pollin.events = POLLIN;
 +
-+	if ( poll( &pollin, 1, -1 ) == -1 )
-+	{
-+		qWarning( "Unexpected poll error." );
-+	}
-+	if ( ! ( pollin.revents & POLLIN ) )
++	switch ( poll( &pollin, 1, 30000 ) )
 +	{
-+		qWarning( "Unexpected poll error." );
-+	}
++		case -1:
++			qWarning( "Unexpected poll error." );
++			break;
 +
-+	m_socket = accept( m_server, NULL, NULL );
-+	if ( m_socket == -1 )
-+	{
-+		qWarning( "Unexpected socket error." );
++		case 0:
++			qWarning( "Remote plugin did not connect." );
++			break;
++
++		default:
++			m_socket = accept( m_server, NULL, NULL );
++			if ( m_socket == -1 )
++			{
++				qWarning( "Unexpected socket error." );
++			}
 +	}
 +#endif
 +
  	resizeSharedProcessingMemory();
  
  	if( waitForInitDoneMsg )
-@@ -337,6 +410,17 @@
+@@ -337,6 +417,17 @@
  }
  
  

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/lmms.git



More information about the debian-edu-commits mailing list