@@ -15,7 +15,11 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
1515
1616    var  useSSL  =  endpoint . protocol  ===  'https:' ; 
1717    var  http  =  useSSL  ? require ( 'https' )  : require ( 'http' ) ; 
18-     http . globalAgent . maxSockets  =  300 ; 
18+     if  ( httpOptions . maxSockets )  { 
19+       http . globalAgent . maxSockets  =  httpOptions . maxSockets ; 
20+     }  else  { 
21+       http . globalAgent . maxSockets  =  300 ; 
22+     } 
1923    var  options  =  { 
2024      host : endpoint . hostname , 
2125      port : endpoint . port , 
@@ -31,6 +35,7 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
3135    TableStore . util . update ( options ,  httpOptions ) ; 
3236    delete  options . proxy ;  // proxy isn't an HTTP option 
3337    delete  options . timeout ;  // timeout isn't an HTTP option 
38+     delete  options . maxSockets ;  // maxSockets isn't an HTTP option 
3439
3540    var  stream  =  http . request ( options ,  function  ( httpResp )  { 
3641      callback ( httpResp ) ; 
@@ -40,15 +45,15 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
4045
4146    // timeout support 
4247    stream . setTimeout ( httpOptions . timeout  ||  0 ) ; 
43-     stream . once ( 'timeout' ,  function ( )  { 
48+     stream . once ( 'timeout' ,  function   ( )  { 
4449      var  msg  =  'Connection timed out after '  +  httpOptions . timeout  +  'ms' ; 
45-       errCallback ( TableStore . util . error ( new  Error ( msg ) ,  { code : 'TimeoutError' } ) ) ; 
50+       errCallback ( TableStore . util . error ( new  Error ( msg ) ,  {   code : 'TimeoutError'   } ) ) ; 
4651
4752      // HACK - abort the connection without tripping our error handler 
4853      // since we already raised our TimeoutError. Otherwise the connection 
4954      // comes back with ECONNRESET, which is not a helpful error message 
5055      stream . removeListener ( 'error' ,  errCallback ) ; 
51-       stream . on ( 'error' ,  function ( )  {  } ) ; 
56+       stream . on ( 'error' ,  function   ( )  {  } ) ; 
5257      stream . abort ( ) ; 
5358    } ) ; 
5459
@@ -78,13 +83,13 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
7883    var  https  =  require ( 'https' ) ; 
7984
8085    if  ( ! TableStore . NodeHttpClient . sslAgent )  { 
81-       TableStore . NodeHttpClient . sslAgent  =  new  https . Agent ( { rejectUnauthorized : true } ) ; 
86+       TableStore . NodeHttpClient . sslAgent  =  new  https . Agent ( {   rejectUnauthorized : true   } ) ; 
8287      TableStore . NodeHttpClient . sslAgent . setMaxListeners ( 0 ) ; 
8388
8489      // delegate maxSockets to globalAgent 
8590      Object . defineProperty ( TableStore . NodeHttpClient . sslAgent ,  'maxSockets' ,  { 
8691        enumerable : true , 
87-         get : function ( )  {  return  https . globalAgent . maxSockets ;  } 
92+         get : function   ( )  {  return  https . globalAgent . maxSockets ;  } 
8893      } ) ; 
8994    } 
9095    return  TableStore . NodeHttpClient . sslAgent ; 
@@ -94,7 +99,7 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
9499    var  numBytes  =  0 ; 
95100    var  totalBytes  =  httpRequest . headers [ 'Content-Length' ] ; 
96101    var  writer  =  new  WritableStream ( ) ; 
97-     writer . _write  =  function ( chunk ,  encoding ,  callback )  { 
102+     writer . _write  =  function   ( chunk ,  encoding ,  callback )  { 
98103      if  ( chunk )  { 
99104        numBytes  +=  chunk . length ; 
100105        stream . emit ( 'sendProgress' ,  { 
@@ -111,7 +116,7 @@ TableStore.NodeHttpClient = TableStore.util.inherit({
111116
112117    var  readable  =  new  ReadableStream ( ) ; 
113118    var  pos  =  0 ; 
114-     readable . _read  =  function ( size )  { 
119+     readable . _read  =  function   ( size )  { 
115120      if  ( pos  >=  buffer . length )  return  readable . push ( null ) ; 
116121
117122      var  end  =  pos  +  size ; 
0 commit comments