Kill tasks when their websocket closes. Sigh.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3779 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		
							
								
								
									
										14
									
								
								core/app.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								core/app.js
									
									
									
									
									
								
							| @@ -38,6 +38,18 @@ function socket(request, response, client) { | ||||
| 	var options = {}; | ||||
| 	var credentials = auth.query(request.headers); | ||||
|  | ||||
| 	response.onClose = async function() { | ||||
| 		if (process && process.task) { | ||||
| 			process.task.kill(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	response.onError = async function(error) { | ||||
| 		if (process && process.task) { | ||||
| 			process.task.kill(); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	response.onMessage = async function(event) { | ||||
| 		if (event.opCode == 0x1 || event.opCode == 0x2) { | ||||
| 			var message; | ||||
| @@ -110,7 +122,7 @@ function socket(request, response, client) { | ||||
| 			} | ||||
| 		} else if (event.opCode == 0x8) { | ||||
| 			// Close. | ||||
| 			if (process) { | ||||
| 			if (process && process.task) { | ||||
| 				process.task.kill(); | ||||
| 			} | ||||
| 			response.send(event.data, 0x8); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user