Disconnect the socket and terminate the process after user disconnect the server. we can't use disconnect event name as it is reserved for socket internal use.
(data)
| 562 | |
| 563 | @sio.on('server-disconnect', namespace='/pty') |
| 564 | def server_disconnect(data): |
| 565 | """ |
| 566 | Disconnect the socket and terminate the process after user disconnect |
| 567 | the server. we can't use disconnect event name as it is reserved for socket |
| 568 | internal use. |
| 569 | """ |
| 570 | # request.sid: refer request.sid as socket id. |
| 571 | if request.sid in pdata and request.sid in app.config['sid_soid_mapping'][ |
| 572 | data['sid']]: |
| 573 | # On disconnect socket manually exit the psql terminal and close the |
| 574 | # parend and child fd then kill the subprocess. |
| 575 | app.config['sid_soid_mapping'][data['sid']] = [soid for soid in |
| 576 | app.config[ |
| 577 | 'sid_soid_mapping'][ |
| 578 | data['sid']] if |
| 579 | soid != request.sid] |
| 580 | disconnect_socket() |
| 581 | |
| 582 | |
| 583 | def cleanup_globals(): |
nothing calls this directly
no test coverage detected