Skip to content

Commit

Permalink
Merge pull request #10 from microservice-framework/2.x-issue-6
Browse files Browse the repository at this point in the history
#6 prevent writing to socket after connection closed and make and out…
  • Loading branch information
Gormartsen authored Mar 11, 2019
2 parents 83867fa + 3779636 commit e340618
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ WebServer.prototype.RequestProcess = function(method, response, requestDetails,
*/
WebServer.prototype.callbackExecutor = function(err, handlerResponse, response, requestDetails) {
var self = this;
if(!response.connection) {
if(err) {
self.debug.log('Writing after socket is closed err: %O', err)
}
self.debug.log('Writing after socket is closed handlerResponse: %O', handlerResponse)
self.debug.log('Writing after socket is closed requestDetails: %O', requestDetails)
return
}

if (self.data.callbacks['responseHandler']) {
return self.data.callbacks['responseHandler'](err, handlerResponse, response, requestDetails);
Expand Down

0 comments on commit e340618

Please sign in to comment.