Use a short timeout for closedown
This commit is contained in:
parent
af338669f3
commit
ea1962e11b
3 changed files with 27 additions and 20 deletions
|
|
@ -39,8 +39,13 @@ function! s:_OnClose( channel ) abort
|
|||
endfunction
|
||||
|
||||
function! s:_Send( msg ) abort
|
||||
if ! exists( 's:job' )
|
||||
echom "Can't send message: Job was not initialised correctly"
|
||||
return
|
||||
endif
|
||||
|
||||
if job_status( s:job ) != 'run'
|
||||
echom "Server isnt running"
|
||||
echom "Can't send message: Job is not running"
|
||||
return
|
||||
endif
|
||||
|
||||
|
|
@ -55,7 +60,7 @@ endfunction
|
|||
|
||||
function! vimspector#internal#job#StartDebugSession( config ) abort
|
||||
if exists( 's:job' )
|
||||
echom "Job is already running"
|
||||
echom "Not starging: Job is already running"
|
||||
return v:none
|
||||
endif
|
||||
|
||||
|
|
@ -72,8 +77,10 @@ function! vimspector#internal#job#StartDebugSession( config ) abort
|
|||
\ }
|
||||
\ )
|
||||
|
||||
echom 'Started job, status is: ' . job_status( s:job )
|
||||
|
||||
if job_status( s:job ) != 'run'
|
||||
echom 'Fail whale. Job is ' . job_status( s:job )
|
||||
echom 'Unable to start job, status is: ' . job_status( s:job )
|
||||
return v:none
|
||||
endif
|
||||
|
||||
|
|
@ -81,9 +88,10 @@ function! vimspector#internal#job#StartDebugSession( config ) abort
|
|||
endfunction
|
||||
|
||||
function! vimspector#internal#job#StopDebugSession() abort
|
||||
if ! exists( 's:job' )
|
||||
if !exists( 's:job' )
|
||||
echom "Not stopping session: Job doesn't exist"
|
||||
return
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if job_status( s:job ) == 'run'
|
||||
call job_stop( s:job, 'term' )
|
||||
|
|
@ -93,9 +101,7 @@ function! vimspector#internal#job#StopDebugSession() abort
|
|||
endfunction
|
||||
|
||||
function! vimspector#internal#job#Reset() abort
|
||||
if exists( 's:job' )
|
||||
call vimspector#internal#job#StopDebugSession()
|
||||
endif
|
||||
call vimspector#internal#job#StopDebugSession()
|
||||
endfunction
|
||||
|
||||
function! vimspector#internal#job#ForceRead() abort
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class DebugAdapterConnection( object ):
|
|||
handler,
|
||||
msg,
|
||||
failure_handler=None,
|
||||
timeout = 5000 ):
|
||||
timeout = 15000 ):
|
||||
this_id = self._next_message_id
|
||||
self._next_message_id += 1
|
||||
|
||||
|
|
@ -66,13 +66,13 @@ class DebugAdapterConnection( object ):
|
|||
request_id = None
|
||||
for seq, request in self._outstanding_requests.items():
|
||||
if request.expiry_id == timer_id:
|
||||
self._AbortRequest( request, 'Timeout' )
|
||||
request_id = seq
|
||||
break
|
||||
|
||||
# Avoid modifying _outstanding_requests while looping
|
||||
if request_id is not None:
|
||||
del self._outstanding_requests[ request_id ]
|
||||
request = self._outstanding_requests.pop( request_id )
|
||||
self._AbortRequest( request, 'Timeout' )
|
||||
|
||||
def DoResponse( self, request, error, response ):
|
||||
this_id = self._next_message_id
|
||||
|
|
@ -95,20 +95,21 @@ class DebugAdapterConnection( object ):
|
|||
def Reset( self ):
|
||||
self._Write = None
|
||||
self._handler = None
|
||||
for _, request in self._outstanding_requests.items():
|
||||
|
||||
while self._outstanding_requests:
|
||||
_, request = self._outstanding_requests.popitem()
|
||||
self._AbortRequest( request, 'Closing down' )
|
||||
self._outstanding_requests.clear()
|
||||
|
||||
def _AbortRequest( self, request, reason ):
|
||||
self._logger.debug( 'Aborting request {} because {}'.format(
|
||||
json.dumps( request.msg ),
|
||||
reason ) )
|
||||
|
||||
self._logger.debug( '{}: Aborting request {}'.format( reason,
|
||||
request.msg ) )
|
||||
_KillTimer( request )
|
||||
if request.failure_handler:
|
||||
request.failure_handler( reason, {} )
|
||||
else:
|
||||
utils.UserMessage( 'Request aborted: {}'.format( reason ) )
|
||||
utils.UserMessage( 'Request for {} aborted: {}'.format(
|
||||
request.msg[ 'command' ],
|
||||
reason ) )
|
||||
|
||||
|
||||
def OnData( self, data ):
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ class DebugSession( object ):
|
|||
'arguments': {
|
||||
'terminateDebugee': True
|
||||
},
|
||||
}, failure_handler = handler )
|
||||
}, failure_handler = handler, timeout = 5000 )
|
||||
|
||||
# This request times out after 5 seconds
|
||||
while not state[ 'done' ]:
|
||||
|
|
@ -426,7 +426,7 @@ class DebugSession( object ):
|
|||
'arguments': {
|
||||
'terminateDebugee': True
|
||||
},
|
||||
}, failure_handler = handler )
|
||||
}, failure_handler = handler, timeout = 5000 )
|
||||
|
||||
def _SelectProcess( self, adapter_config, launch_config ):
|
||||
atttach_config = adapter_config[ 'attach' ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue