mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-10 14:40:00 +00:00
skypiax: beginning to avoid crashes when Skype clients die, XWindows related
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14610 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5abd10c0c3
commit
d9deb2327c
@ -359,6 +359,7 @@ static switch_status_t remove_interface(char *the_interface)
|
|||||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
if(tech_pvt->running && tech_pvt->SkypiaxHandles.disp){
|
||||||
XEvent e;
|
XEvent e;
|
||||||
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
||||||
memset(&e, 0, sizeof(e));
|
memset(&e, 0, sizeof(e));
|
||||||
@ -370,6 +371,7 @@ static switch_status_t remove_interface(char *the_interface)
|
|||||||
|
|
||||||
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
|
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
|
||||||
XSync(tech_pvt->SkypiaxHandles.disp, False);
|
XSync(tech_pvt->SkypiaxHandles.disp, False);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1441,6 +1443,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
|||||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
if(tech_pvt->SkypiaxHandles.disp){
|
||||||
XEvent e;
|
XEvent e;
|
||||||
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
||||||
False);
|
False);
|
||||||
@ -1453,6 +1456,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
|||||||
|
|
||||||
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
|
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
|
||||||
XSync(tech_pvt->SkypiaxHandles.disp, False);
|
XSync(tech_pvt->SkypiaxHandles.disp, False);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
x = 10;
|
x = 10;
|
||||||
|
@ -1271,7 +1271,7 @@ int X11_errors_handler(Display * dpy, XErrorEvent * err)
|
|||||||
|
|
||||||
xerror = err->error_code;
|
xerror = err->error_code;
|
||||||
ERRORA("Received error code %d from X Server\n\n", SKYPIAX_P_LOG, xerror); ///FIXME why crash the entire skypiax? just crash the interface, instead
|
ERRORA("Received error code %d from X Server\n\n", SKYPIAX_P_LOG, xerror); ///FIXME why crash the entire skypiax? just crash the interface, instead
|
||||||
running = 0;
|
//running = 0;
|
||||||
return 0; /* ignore the error */
|
return 0; /* ignore the error */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,15 +1287,16 @@ static int X11_errors_untrap(void)
|
|||||||
return (xerror != BadValue) && (xerror != BadWindow);
|
return (xerror != BadValue) && (xerror != BadWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
|
int skypiax_send_message(private_t * tech_pvt, const char *message_P)
|
||||||
{
|
{
|
||||||
|
struct SkypiaxHandles *SkypiaxHandles;
|
||||||
Window w_P;
|
Window w_P;
|
||||||
Display *disp;
|
Display *disp;
|
||||||
Window handle_P;
|
Window handle_P;
|
||||||
int ok;
|
int ok;
|
||||||
private_t *tech_pvt = NULL;
|
//private_t *tech_pvt = NULL;
|
||||||
|
|
||||||
|
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
|
||||||
w_P = SkypiaxHandles->skype_win;
|
w_P = SkypiaxHandles->skype_win;
|
||||||
disp = SkypiaxHandles->disp;
|
disp = SkypiaxHandles->disp;
|
||||||
handle_P = SkypiaxHandles->win;
|
handle_P = SkypiaxHandles->win;
|
||||||
@ -1328,8 +1329,11 @@ int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *mess
|
|||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
ok = X11_errors_untrap();
|
ok = X11_errors_untrap();
|
||||||
|
|
||||||
if (!ok)
|
if (!ok){
|
||||||
ERRORA("Sending message failed with status %d\n", SKYPIAX_P_LOG, xerror);
|
ERRORA("Sending message failed with status %d\n", SKYPIAX_P_LOG, xerror);
|
||||||
|
tech_pvt->running = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
//XUnlockDisplay(disp);
|
//XUnlockDisplay(disp);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -1337,13 +1341,11 @@ int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *mess
|
|||||||
|
|
||||||
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
||||||
{
|
{
|
||||||
struct SkypiaxHandles *SkypiaxHandles;
|
|
||||||
|
|
||||||
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
|
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
|
||||||
|
|
||||||
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
|
|
||||||
|
|
||||||
if (!skypiax_send_message(SkypiaxHandles, msg_to_skype)) {
|
if (!skypiax_send_message(tech_pvt, msg_to_skype)) {
|
||||||
ERRORA
|
ERRORA
|
||||||
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
|
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
|
||||||
SKYPIAX_P_LOG);
|
SKYPIAX_P_LOG);
|
||||||
@ -1457,7 +1459,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
|||||||
|
|
||||||
snprintf(buf, 512, "NAME skypiax");
|
snprintf(buf, 512, "NAME skypiax");
|
||||||
|
|
||||||
if (!skypiax_send_message(SkypiaxHandles, buf)) {
|
if (!skypiax_send_message(tech_pvt, buf)) {
|
||||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
||||||
running = 0;
|
running = 0;
|
||||||
if(disp)
|
if(disp)
|
||||||
@ -1466,7 +1468,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, 512, "PROTOCOL 7");
|
snprintf(buf, 512, "PROTOCOL 7");
|
||||||
if (!skypiax_send_message(SkypiaxHandles, buf)) {
|
if (!skypiax_send_message(tech_pvt, buf)) {
|
||||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
||||||
running = 0;
|
running = 0;
|
||||||
if(disp)
|
if(disp)
|
||||||
@ -1487,7 +1489,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
|||||||
memset(buffer, '\0', 17000);
|
memset(buffer, '\0', 17000);
|
||||||
b = buffer;
|
b = buffer;
|
||||||
|
|
||||||
while (1) {
|
while (running && tech_pvt->running) {
|
||||||
XNextEvent(disp, &an_event);
|
XNextEvent(disp, &an_event);
|
||||||
if (!(running && tech_pvt->running))
|
if (!(running && tech_pvt->running))
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user