rpms/nspluginwrapper/devel nspluginwrapper-0.9.91.4-rh.patch, 1.7, 1.8 nspluginwrapper.spec, 1.14, 1.15
Martin Stransky (stransky)
fedora-extras-commits at redhat.com
Mon Aug 27 10:04:22 UTC 2007
Author: stransky
Update of /cvs/pkgs/rpms/nspluginwrapper/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7196
Modified Files:
nspluginwrapper-0.9.91.4-rh.patch nspluginwrapper.spec
Log Message:
converted rpc error handling code to a thread-safe variant, added a time limit to plugin restart
nspluginwrapper-0.9.91.4-rh.patch:
Index: nspluginwrapper-0.9.91.4-rh.patch
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/devel/nspluginwrapper-0.9.91.4-rh.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- nspluginwrapper-0.9.91.4-rh.patch 14 Aug 2007 10:58:08 -0000 1.7
+++ nspluginwrapper-0.9.91.4-rh.patch 27 Aug 2007 10:04:18 -0000 1.8
@@ -1,5 +1,5 @@
--- nspluginwrapper-0.9.91.4/Makefile.rh 2007-04-03 07:31:22.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/Makefile 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/Makefile 2007-08-27 11:14:46.000000000 +0200
@@ -52,23 +52,6 @@ ifneq (,$(findstring $(OS),netbsd dragon
X_LDFLAGS += -Wl,--rpath,$(x11prefix)/$(lib64)
endif
@@ -235,7 +235,7 @@
-Wl,--version-script,$(patsubst $(LSB_OBJ_DIR)/%.o,$(LSB_SRC_DIR)/%.Version,$<) \
-Wl,-soname,`grep "$(patsubst $(LSB_OBJ_DIR)/%.o,%,$<) " $(LSB_SRC_DIR)/LibNameMap.txt | cut -f2 -d' '`
--- nspluginwrapper-0.9.91.4/configure.rh 2007-04-02 23:42:24.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/configure 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/configure 2007-08-27 11:14:46.000000000 +0200
@@ -21,45 +21,18 @@ TMPS="${TMPDIR1}/npw-conf-${RANDOM}-$$-$
# default parameters
@@ -652,7 +652,7 @@
+echo "DONT_STRIP=yes" >> $config_mak
+
--- nspluginwrapper-0.9.91.4/src/npw-wrapper.c.rh 2007-04-02 21:52:57.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-wrapper.c 2007-08-14 12:39:40.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-wrapper.c 2007-08-27 11:28:24.000000000 +0200
@@ -42,6 +42,7 @@
#include "rpc.h"
@@ -670,16 +670,20 @@
// Instance state information about the plugin
typedef struct _PluginInstance {
NPP instance;
-@@ -100,6 +103,8 @@ typedef struct _StreamInstance {
+@@ -100,6 +103,12 @@ typedef struct _StreamInstance {
static void plugin_init(int is_NP_Initialize);
static void plugin_exit(void);
static pthread_mutex_t plugin_init_lock = PTHREAD_MUTEX_INITIALIZER;
+static NPError plugin_restart(void);
+static NPError check_restart(void);
++static time_t last_restart = 0;
++
++// Minimal time between two plugin restarts in sec
++#define RESTART_INTERVAL 1
// Helpers
#ifndef min
-@@ -182,7 +187,7 @@ g_NPN_GetValue(NPP instance, NPNVariable
+@@ -182,7 +191,7 @@ g_NPN_GetValue(NPP instance, NPNVariable
if (mozilla_funcs.getvalue == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
@@ -688,31 +692,7 @@
NPError ret = mozilla_funcs.getvalue(instance, variable, value);
D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
return ret;
-@@ -190,20 +195,20 @@ g_NPN_GetValue(NPP instance, NPNVariable
-
- static int handle_NPN_GetValue(rpc_connection_t *connection)
- {
-- D(bug("handle_NPN_GetValue\n"));
--
- NPP instance;
- uint32_t variable;
-+
- int error = rpc_method_get_args(connection,
- RPC_TYPE_NPP, &instance,
- RPC_TYPE_UINT32, &variable,
- RPC_TYPE_INVALID);
--
- if (error != RPC_ERROR_NO_ERROR) {
- npw_perror("NPN_GetValue() get args", error);
- return error;
- }
-
-+ D(bug("handle_NPN_GetValue() - variable %d\n",variable & 0xffff));
-+
- NPError ret = NPERR_GENERIC_ERROR;
- switch (rpc_type_of_NPNVariable(variable)) {
- case RPC_TYPE_BOOLEAN:
-@@ -220,6 +225,7 @@ static int handle_NPN_GetValue(rpc_conne
+@@ -220,6 +229,7 @@ static int handle_NPN_GetValue(rpc_conne
}
}
@@ -720,7 +700,7 @@
abort();
}
-@@ -956,7 +962,12 @@ g_NPP_New(NPMIMEType mime_type, NPP inst
+@@ -956,7 +966,12 @@ g_NPP_New(NPMIMEType mime_type, NPP inst
{
if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
@@ -734,7 +714,7 @@
PluginInstance *plugin = malloc(sizeof(*plugin));
if (plugin == NULL)
return NPERR_OUT_OF_MEMORY_ERROR;
-@@ -1204,8 +1215,9 @@ invoke_NPP_URLNotify(NPP instance, const
+@@ -1204,8 +1219,9 @@ invoke_NPP_URLNotify(NPP instance, const
error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INVALID);
@@ -745,7 +725,7 @@
}
static void
-@@ -1639,7 +1651,7 @@ NP_Initialize(NPNetscapeFuncs *moz_funcs
+@@ -1639,7 +1655,7 @@ NP_Initialize(NPNetscapeFuncs *moz_funcs
return NPERR_MODULE_LOAD_FAILED_ERROR;
// NPRuntime appeared in NPAPI >= 0.14
@@ -754,7 +734,7 @@
if ((moz_funcs->version >> 8) == 0 && (moz_funcs->version & 0xff) < 14)
has_npruntime = false;
// check that the browser doesn't lie
-@@ -1742,9 +1754,9 @@ static void do_plugin_init(int is_NP_Ini
+@@ -1742,9 +1758,9 @@ static void do_plugin_init(int is_NP_Ini
static int init_count = 0;
++init_count;
char viewer_path[PATH_MAX];
@@ -766,7 +746,7 @@
// Cache MIME info and plugin name/description
if (g_plugin.name == NULL && g_plugin.description == NULL && g_plugin.formats == NULL) {
-@@ -1990,3 +2002,59 @@ static void __attribute__((destructor))
+@@ -1990,3 +2006,64 @@ static void __attribute__((destructor))
g_plugin.description = NULL;
}
}
@@ -774,60 +754,65 @@
+static NPError plugin_restart(void)
+{
+ if(!g_plugin.is_wrapper) {
-+ D(bug("plugin restart\n"));
++ D(bug("plugin restart\n"));
+
-+ // Shut it down
-+ plugin_exit();
++ // Shut it down
++ plugin_exit();
+
-+ g_plugin.initialized = 0;
-+ g_plugin.viewer_pid = -1;
-+ g_plugin.is_wrapper = 0;
-+
-+ // And start it again
-+ plugin_init(1);
-+ if (g_plugin.initialized <= 0)
-+ return NPERR_MODULE_LOAD_FAILED_ERROR;
++ g_plugin.initialized = 0;
++ g_plugin.viewer_pid = -1;
++ g_plugin.is_wrapper = 0;
++
++ // And start it again
++ plugin_init(1);
++ if (g_plugin.initialized <= 0)
++ return NPERR_MODULE_LOAD_FAILED_ERROR;
+
-+ int error = rpc_method_invoke(g_rpc_connection,
-+ RPC_METHOD_NP_INITIALIZE,
-+ RPC_TYPE_UINT32, (uint32_t)has_npruntime,
-+ RPC_TYPE_INVALID);
++ int error = rpc_method_invoke(g_rpc_connection,
++ RPC_METHOD_NP_INITIALIZE,
++ RPC_TYPE_UINT32, (uint32_t)has_npruntime,
++ RPC_TYPE_INVALID);
+
-+ if (error != RPC_ERROR_NO_ERROR) {
++ if (error != RPC_ERROR_NO_ERROR) {
+ npw_perror("NP_Initialize() invoke", error);
+ return NPERR_MODULE_LOAD_FAILED_ERROR;
-+ }
++ }
+
-+ int32_t ret;
-+ error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID);
++ int32_t ret;
++ error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID);
+
-+ if (error != RPC_ERROR_NO_ERROR) {
++ if (error != RPC_ERROR_NO_ERROR) {
+ npw_perror("NP_Initialize() wait for reply", error);
+ return NPERR_MODULE_LOAD_FAILED_ERROR;
-+ }
++ }
+
-+ D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
-+ return ret;
-+
-+ return NPERR_NO_ERROR;
++ D(bug(" return: %d [%s]\n", ret, string_of_NPError(ret)));
++ return ret;
+ }
++ return NPERR_NO_ERROR;
+}
+
+static NPError check_restart(void)
+{
-+ if(get_network_status()) {
++ if(rpc_status_get(g_rpc_connection)) {
++
++ time_t atime = time(NULL);
++ if(atime - last_restart < RESTART_INTERVAL)
++ return(NPERR_GENERIC_ERROR);
++ last_restart = atime;
++
+ D(bug("Plugin restart\n"));
+ int ret = plugin_restart();
+ if(ret == NPERR_NO_ERROR) {
-+ clear_network_status();
++ rpc_error_clear(g_rpc_connection);
+ }
+ D(bug("check_restart return %d [%s]\n", ret, string_of_NPError(ret)));
+ return(ret);
+ }
+ return(NPERR_NO_ERROR);
+}
---- /dev/null 2007-08-14 10:11:09.632093891 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-dir.c 2007-08-14 12:36:19.000000000 +0200
+--- /dev/null 2007-08-27 09:27:39.694821295 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-dir.c 2007-08-27 11:14:46.000000000 +0200
@@ -0,0 +1,97 @@
+/*
+ * npw-dir.h - Directory management for nspluginwrapper
@@ -926,46 +911,8 @@
+ snprintf(p_path, max_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, p_plugin, getpid(), init_count);
+ return(p_path);
+}
---- nspluginwrapper-0.9.91.4/src/utils.c.rh 2007-03-04 16:01:22.000000000 +0100
-+++ nspluginwrapper-0.9.91.4/src/utils.c 2007-08-14 12:39:12.000000000 +0200
-@@ -171,6 +171,35 @@ const char *string_of_NPStreamType(int s
- }
- #endif
-
-+/* ====================================================================== */
-+/* === Network status === */
-+/* ====================================================================== */
-+
-+#define ERROR_RPC(error) ((error) > -1100 && (error) <= -1000)
-+
-+static int network_error = FALSE;
-+
-+void check_network_error(int err_code)
-+{
-+ if(ERROR_RPC(err_code))
-+ network_error = TRUE;
-+}
-+
-+void set_network_error(void)
-+{
-+ network_error = TRUE;
-+}
-+
-+int get_network_status(void)
-+{
-+ return(network_error);
-+}
-+
-+void clear_network_status(void)
-+{
-+ network_error = FALSE;
-+}
-+
-
- /* ====================================================================== */
- /* === Misc utility functions === */
--- nspluginwrapper-0.9.91.4/src/debug.h.rh 2007-03-04 16:01:22.000000000 +0100
-+++ nspluginwrapper-0.9.91.4/src/debug.h 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/debug.h 2007-08-27 11:14:46.000000000 +0200
@@ -29,7 +29,7 @@ extern void npw_printf(const char *forma
extern void npw_vprintf(const char *format, va_list args) attribute_hidden;
@@ -976,7 +923,7 @@
#else
#define D(x) ;
--- nspluginwrapper-0.9.91.4/src/sysdeps.h.rh 2007-03-04 16:01:22.000000000 +0100
-+++ nspluginwrapper-0.9.91.4/src/sysdeps.h 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/sysdeps.h 2007-08-27 11:14:46.000000000 +0200
@@ -43,8 +43,8 @@
#define NPW_VIEWER NPW_VIEWER_BASE
#define NPW_WRAPPER_BASE "npwrapper"
@@ -988,21 +935,8 @@
#define NPW_PLUGIN_IDENT "NPW:" NPW_VERSION
#define NPW_PLUGIN_IDENT_SIZE 32
typedef struct __attribute__((packed)) {
---- nspluginwrapper-0.9.91.4/src/utils.h.rh 2007-03-04 16:01:22.000000000 +0100
-+++ nspluginwrapper-0.9.91.4/src/utils.h 2007-08-14 12:39:29.000000000 +0200
-@@ -39,4 +39,10 @@ extern const char *string_of_NPStreamTyp
- extern void npw_perror(const char *prefix, int error) attribute_hidden;
- extern const char *npw_strerror(int error) attribute_hidden;
-
-+// Network status
-+void check_network_error(int err_code);
-+int get_network_status(void);
-+void clear_network_status(void);
-+void set_network_error(void);
-+
- #endif /* UTILS_H */
--- nspluginwrapper-0.9.91.4/src/npw-viewer.c.rh 2007-04-02 21:52:57.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-viewer.c 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-viewer.c 2007-08-27 11:14:46.000000000 +0200
@@ -53,10 +53,6 @@
#define DEBUG 1
#include "debug.h"
@@ -1092,7 +1026,7 @@
}
--- nspluginwrapper-0.9.91.4/src/npw-viewer.sh.rh 2007-04-02 21:52:57.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-viewer.sh 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-viewer.sh 2007-08-27 11:14:46.000000000 +0200
@@ -4,7 +4,13 @@
#
OS="`uname -s`"
@@ -1163,7 +1097,7 @@
if test "$OS" = "NetBSD"; then
REALPLAYER_HOME="/usr/pkg/lib/RealPlayer"
--- nspluginwrapper-0.9.91.4/src/npw-rpc.c.rh 2007-04-02 21:52:57.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-rpc.c 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-rpc.c 2007-08-27 11:14:46.000000000 +0200
@@ -49,6 +49,8 @@ int rpc_type_of_NPNVariable(int variable
case NPNVSupportsXEmbedBool:
type = RPC_TYPE_BOOLEAN;
@@ -1173,8 +1107,8 @@
case NPNVWindowNPObject:
case NPNVPluginElementNPObject:
type = RPC_TYPE_NP_OBJECT;
---- /dev/null 2007-08-14 10:11:09.632093891 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-dir.h 2007-08-14 12:36:19.000000000 +0200
+--- /dev/null 2007-08-27 09:27:39.694821295 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-dir.h 2007-08-27 11:14:46.000000000 +0200
@@ -0,0 +1,35 @@
+/*
+ * npw-dir.h - Directory management for nspluginwrapper
@@ -1212,7 +1146,7 @@
+
+#endif
--- nspluginwrapper-0.9.91.4/src/npw-config.c.rh 2007-04-02 22:42:15.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/npw-config.c 2007-08-14 12:36:19.000000000 +0200
++++ nspluginwrapper-0.9.91.4/src/npw-config.c 2007-08-27 11:14:46.000000000 +0200
@@ -38,10 +38,15 @@
#include <pwd.h>
#include <dirent.h>
@@ -1910,27 +1844,106 @@
}
return 0;
+--- nspluginwrapper-0.9.91.4/src/rpc.h.rh 2007-03-04 16:01:22.000000000 +0100
++++ nspluginwrapper-0.9.91.4/src/rpc.h 2007-08-27 11:14:46.000000000 +0200
+@@ -103,4 +103,11 @@ extern int rpc_method_wait_for_reply(rpc
+ extern int rpc_method_get_args(rpc_connection_t *connection, ...) attribute_hidden;
+ extern int rpc_method_send_reply(rpc_connection_t *connection, ...) attribute_hidden;
+
++// Error handling
++void rpc_error_check(rpc_connection_t *connection, int err_code);
++int rpc_error_get(rpc_connection_t *connection);
++void rpc_error_set(rpc_connection_t *connection);
++void rpc_error_clear(rpc_connection_t *connection);
++int rpc_status_get(rpc_connection_t *connection);
++
+ #endif /* RPC_H */
--- nspluginwrapper-0.9.91.4/src/rpc.c.rh 2007-04-02 22:03:07.000000000 +0200
-+++ nspluginwrapper-0.9.91.4/src/rpc.c 2007-08-14 12:36:19.000000000 +0200
-@@ -1441,8 +1441,10 @@ int rpc_method_invoke(rpc_connection_t *
++++ nspluginwrapper-0.9.91.4/src/rpc.c 2007-08-27 11:14:46.000000000 +0200
+@@ -232,6 +232,7 @@ const char *rpc_strerror(int error)
+ return str;
+ }
+
++
+ // Set non blocking I/O on the specified socket
+ static int rpc_set_non_blocking_io(int socket)
+ {
+@@ -293,12 +294,41 @@ struct rpc_connection_t {
+ int server_socket;
+ int server_thread_active;
+ pthread_t server_thread;
++ int last_error;
+ rpc_method_descriptor_t *callbacks;
+ int n_callbacks;
+ int send_offset;
+ char send_buffer[BUFSIZ];
+ };
+
++#define ERROR_RPC(error) ((error) > -1100 && (error) <= -1000)
++
++void rpc_error_check(rpc_connection_t *connection, int err_code)
++{
++ if(ERROR_RPC(err_code))
++ connection->last_error = err_code;
++}
++
++int rpc_error_get(rpc_connection_t *connection)
++{
++ return(connection->last_error);
++}
++
++void rpc_error_set(rpc_connection_t *connection)
++{
++ connection->last_error = RPC_ERROR_GENERIC;
++}
++
++void rpc_error_clear(rpc_connection_t *connection)
++{
++ connection->last_error = 0;
++}
++
++int rpc_status_get(rpc_connection_t *connection)
++{
++ return(ERROR_RPC(connection->last_error));
++}
++
+ // Returns socket fd or -1 if invalid connection
+ int rpc_socket(rpc_connection_t *connection)
+ {
+@@ -378,6 +408,7 @@ rpc_connection_t *rpc_init_server(const
+ connection->server_thread_active = 0;
+ connection->callbacks = NULL;
+ connection->n_callbacks = 0;
++ connection->last_error = 0;
+
+ if ((connection->server_socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ perror("server socket");
+@@ -426,6 +457,7 @@ rpc_connection_t *rpc_init_client(const
+ connection->server_socket = -1;
+ connection->callbacks = NULL;
+ connection->n_callbacks = 0;
++ connection->last_error = 0;
+
+ if ((connection->socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ perror("client socket");
+@@ -1441,8 +1473,9 @@ int rpc_method_invoke(rpc_connection_t *
{
D(bug("rpc_method_invoke method=%d\n", method));
- if (connection == NULL)
+ if (connection == NULL) {
-+ set_network_error();
return RPC_ERROR_CONNECTION_NULL;
+ }
rpc_message_t message;
rpc_message_init(&message, connection);
-@@ -1452,29 +1454,41 @@ int rpc_method_invoke(rpc_connection_t *
+@@ -1452,29 +1485,41 @@ int rpc_method_invoke(rpc_connection_t *
int ret = _rpc_wait_dispatch(connection, 0);
if (ret == 0)
break;
- if (ret < 0 || (ret = rpc_dispatch(connection)) < 0)
+ if (ret < 0 || (ret = rpc_dispatch(connection)) < 0) {
-+ check_network_error(ret);
++ rpc_error_check(connection,ret);
return ret;
+ }
}
@@ -1939,28 +1952,28 @@
int error = rpc_message_send_int32(&message, RPC_MESSAGE_START);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_send_int32(&message, method);
- if (error != RPC_ERROR_NO_ERROR)
- return error;
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
+ return error;
+ }
error = rpc_message_send_int32(&message, RPC_MESSAGE_END);
- if (error != RPC_ERROR_NO_ERROR)
- return error;
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
+ return error;
+ }
error = rpc_message_flush(&message);
- if (error != RPC_ERROR_NO_ERROR)
- return error;
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
+ return error;
+ }
@@ -1970,25 +1983,25 @@
- if (error != RPC_ERROR_NO_ERROR)
- return error;
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
+ return error;
+ }
if (msg_tag != RPC_MESSAGE_ACK)
return RPC_ERROR_MESSAGE_TYPE_INVALID;
-@@ -1489,16 +1503,22 @@ int rpc_method_invoke(rpc_connection_t *
+@@ -1489,16 +1534,22 @@ int rpc_method_invoke(rpc_connection_t *
va_start(args, method);
error = rpc_message_send_args(&message, args);
va_end(args);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_flush(&message);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
@@ -1996,19 +2009,19 @@
error = rpc_message_recv_int32(&message, &msg_tag);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
if (msg_tag != RPC_MESSAGE_ACK)
return RPC_ERROR_MESSAGE_TYPE_INVALID;
}
-@@ -1522,16 +1542,22 @@ int rpc_method_get_args(rpc_connection_t
+@@ -1522,16 +1573,22 @@ int rpc_method_get_args(rpc_connection_t
va_start(args, connection);
int error = rpc_message_recv_args(&message, args);
va_end(args);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
@@ -2016,74 +2029,73 @@
error = rpc_message_send_int32(&message, RPC_MESSAGE_ACK);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_flush(&message);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
return RPC_ERROR_NO_ERROR;
}
-@@ -1545,8 +1571,10 @@ int rpc_method_wait_for_reply(rpc_connec
+@@ -1545,8 +1602,9 @@ int rpc_method_wait_for_reply(rpc_connec
va_list args;
rpc_message_t message;
- if (connection == NULL)
+ if (connection == NULL) {
-+ set_network_error();
return RPC_ERROR_CONNECTION_NULL;
+ }
rpc_message_init(&message, connection);
va_start(args, connection);
-@@ -1558,12 +1586,16 @@ int rpc_method_wait_for_reply(rpc_connec
+@@ -1558,12 +1616,16 @@ int rpc_method_wait_for_reply(rpc_connec
bool done = false;
while (!done) {
error = rpc_message_recv_int32(&message, &msg_tag);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
switch (msg_tag) {
case RPC_MESSAGE_START:
- if ((error = _rpc_dispatch(connection, &message)) < 0)
+ if ((error = _rpc_dispatch(connection, &message)) < 0) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
break;
case RPC_MESSAGE_REPLY:
case RPC_MESSAGE_ACK:
-@@ -1574,8 +1606,10 @@ int rpc_method_wait_for_reply(rpc_connec
+@@ -1574,8 +1636,10 @@ int rpc_method_wait_for_reply(rpc_connec
// wait: <error-code>
int32_t error_code;
error = rpc_message_recv_int32(&message, &error_code);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
return error_code;
}
default:
-@@ -1591,26 +1625,36 @@ int rpc_method_wait_for_reply(rpc_connec
+@@ -1591,26 +1655,36 @@ int rpc_method_wait_for_reply(rpc_connec
va_start(args, connection);
error = rpc_message_recv_args(&message, args);
va_end(args);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_recv_int32(&message, &msg_tag);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
if (msg_tag != RPC_MESSAGE_END)
@@ -2093,13 +2105,13 @@
error = rpc_message_send_int32(&message, RPC_MESSAGE_ACK);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_flush(&message);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
@@ -2107,19 +2119,19 @@
error = rpc_message_recv_int32(&message, &msg_tag);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
}
// wait: MESSAGE_ACK
-@@ -1633,26 +1677,36 @@ int rpc_method_send_reply(rpc_connection
+@@ -1633,26 +1707,36 @@ int rpc_method_send_reply(rpc_connection
// send: <reply> = MESSAGE_REPLY [ <method-args> ] MESSAGE_END
int error = rpc_message_send_int32(&message, RPC_MESSAGE_REPLY);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
va_list args;
@@ -2128,19 +2140,19 @@
va_end(args);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_send_int32(&message, RPC_MESSAGE_END);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
error = rpc_message_flush(&message);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
@@ -2149,7 +2161,7 @@
error = rpc_message_recv_int32(&message, &msg_tag);
- if (error != RPC_ERROR_NO_ERROR)
+ if (error != RPC_ERROR_NO_ERROR) {
-+ set_network_error();
++ rpc_error_check(connection,error);
return error;
+ }
if (msg_tag != RPC_MESSAGE_ACK)
Index: nspluginwrapper.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nspluginwrapper/devel/nspluginwrapper.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- nspluginwrapper.spec 14 Aug 2007 10:58:08 -0000 1.14
+++ nspluginwrapper.spec 27 Aug 2007 10:04:18 -0000 1.15
@@ -70,7 +70,7 @@
Summary: A compatibility layer for Netscape 4 plugins
Name: nspluginwrapper
Version: 0.9.91.4
-Release: 18%{?dist}
+Release: 19%{?dist}
Source0: %{name}-%{version}%{?svndate:-%{svndate}}.tar.bz2
Source1: %{plugin_config_name}.tar.gz
Source2: plugin-config.sh.in
@@ -201,7 +201,9 @@
/usr/bin/mozilla-plugin-config -i -f > /dev/null 2>&1
%preun
-/usr/bin/mozilla-plugin-config -r > /dev/null 2>&1
+if [ "$1" == "0" ]; then
+ /usr/bin/mozilla-plugin-config -r > /dev/null 2>&1
+fi;
%files
%defattr(-,root,root)
@@ -219,6 +221,10 @@
%{_sysconfdir}/sysconfig/%{name}
%changelog
+* Mon Aug 27 2007 Martin Stransky <stransky at redhat.com> 0.9.91.4-19
+- converted rpc error handling code to a thread-safe variant
+- added a time limit to plugin restart
+
* Tue Aug 14 2007 Martin Stransky <stransky at redhat.com> 0.9.91.4-18
- implemented plugin restart (#251530)
More information about the fedora-extras-commits
mailing list