mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-28 06:52:35 +00:00
set flag to allow forced unload of a running VM
required to prevent a client from exiting if the server disconnects (bug 3585)
This commit is contained in:
parent
8bcb33892e
commit
43ac1eca6a
3 changed files with 21 additions and 2 deletions
|
@ -277,7 +277,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
|
||||||
|
|
||||||
if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
|
if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) {
|
||||||
CL_Disconnect( qtrue );
|
CL_Disconnect( qtrue );
|
||||||
|
VM_Forced_Unload_Start();
|
||||||
CL_FlushMemory( );
|
CL_FlushMemory( );
|
||||||
|
VM_Forced_Unload_Done();
|
||||||
// make sure we can get at our local stuff
|
// make sure we can get at our local stuff
|
||||||
FS_PureServerSetLoadedPaks("", "");
|
FS_PureServerSetLoadedPaks("", "");
|
||||||
com_errorEntered = qfalse;
|
com_errorEntered = qfalse;
|
||||||
|
|
|
@ -325,6 +325,8 @@ vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *),
|
||||||
|
|
||||||
void VM_Free( vm_t *vm );
|
void VM_Free( vm_t *vm );
|
||||||
void VM_Clear(void);
|
void VM_Clear(void);
|
||||||
|
void VM_Forced_Unload_Start(void);
|
||||||
|
void VM_Forced_Unload_Done(void);
|
||||||
vm_t *VM_Restart( vm_t *vm );
|
vm_t *VM_Restart( vm_t *vm );
|
||||||
|
|
||||||
intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... );
|
intptr_t QDECL VM_Call( vm_t *vm, int callNum, ... );
|
||||||
|
|
|
@ -40,6 +40,9 @@ vm_t *currentVM = NULL;
|
||||||
vm_t *lastVM = NULL;
|
vm_t *lastVM = NULL;
|
||||||
int vm_debugLevel;
|
int vm_debugLevel;
|
||||||
|
|
||||||
|
// used by Com_Error to get rid of running vm's before longjmp
|
||||||
|
static int forced_unload;
|
||||||
|
|
||||||
#define MAX_VM 3
|
#define MAX_VM 3
|
||||||
vm_t vmTable[MAX_VM];
|
vm_t vmTable[MAX_VM];
|
||||||
|
|
||||||
|
@ -613,8 +616,12 @@ void VM_Free( vm_t *vm ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vm->callLevel) {
|
if(vm->callLevel) {
|
||||||
Com_Error( ERR_FATAL, "VM_Free(%s) on running vm", vm->name );
|
if(!forced_unload) {
|
||||||
return;
|
Com_Error( ERR_FATAL, "VM_Free(%s) on running vm", vm->name );
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Com_Printf( "forcefully unloading %s vm\n", vm->name );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vm->destroy)
|
if(vm->destroy)
|
||||||
|
@ -648,6 +655,14 @@ void VM_Clear(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VM_Forced_Unload_Start(void) {
|
||||||
|
forced_unload = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VM_Forced_Unload_Done(void) {
|
||||||
|
forced_unload = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void *VM_ArgPtr( intptr_t intValue ) {
|
void *VM_ArgPtr( intptr_t intValue ) {
|
||||||
if ( !intValue ) {
|
if ( !intValue ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue