mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
219 lines
34 KiB
HTML
219 lines
34 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.9.8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>tgstation-server: src/Tgstation.Server.Host/IO/RequestFileStreamProvider.cs Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">tgstation-server<span id="projectnumber"> 6.19.3</span>
|
|
</div>
|
|
<div id="projectbrief">The /tg/station 13 server suite</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.8 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search/",'.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_codefold(0); });
|
|
/* @license-end */
|
|
</script>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<div id="MSearchResults">
|
|
<div class="SRPage">
|
|
<div id="SRIndex">
|
|
<div id="SRResults"></div>
|
|
<div class="SRStatus" id="Loading">Loading...</div>
|
|
<div class="SRStatus" id="Searching">Searching...</div>
|
|
<div class="SRStatus" id="NoMatches">No Matches</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_a536e49cdf631f66733cf2c9791144ce.html">IO</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle"><div class="title">RequestFileStreamProvider.cs</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="_request_file_stream_provider_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
|
|
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.IO;</div>
|
|
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Net.Http;</div>
|
|
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">using </span>System.Threading;</div>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>System.Threading.Tasks;</div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
|
|
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_common_1_1_http.html">Tgstation.Server.Common.Http</a>;</div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> </div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a></div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span>{</div>
|
|
<div class="foldopen" id="foldopen00014" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html"> 14</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html">RequestFileStreamProvider</a> : <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_file_stream_provider.html">IFileStreamProvider</a></div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> {</div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa"> 19</a></span> readonly HttpClient <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a>;</div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6"> 24</a></span> readonly HttpRequestMessage <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a>;</div>
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26"> 29</a></span> readonly CancellationTokenSource <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>;</div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011"> 34</a></span> Task<CachedResponseStream>? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">downloadTask</a>;</div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6"> 39</a></span> <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6">disposed</a>;</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
|
|
<div class="foldopen" id="foldopen00046" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5c9a0890384f6c881deaee92e71ac71b"> 46</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5c9a0890384f6c881deaee92e71ac71b">RequestFileStreamProvider</a>(HttpClient <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a>, HttpRequestMessage <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a>)</div>
|
|
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> {</div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> this.httpClient = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a>));</div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> this.requestMessage = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a>));</div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a> = <span class="keyword">new</span> CancellationTokenSource();</div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
|
|
<div class="foldopen" id="foldopen00055" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#af1560622a7d79f2207f23c3cfcaf88a5"> 55</a></span> <span class="keyword">public</span> async ValueTask <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#af1560622a7d79f2207f23c3cfcaf88a5">DisposeAsync</a>()</div>
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> {</div>
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> Task<CachedResponseStream>? localDownloadTask;</div>
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> lock (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>)</div>
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> {</div>
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6">disposed</a>)</div>
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">return</span>;</div>
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6">disposed</a> = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> localDownloadTask = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">downloadTask</a>;</div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">downloadTask</a> = <span class="keyword">null</span>;</div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> }</div>
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>.Cancel();</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>.Dispose();</div>
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordflow">if</span> (localDownloadTask != <span class="keyword">null</span>)</div>
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> {</div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html">CachedResponseStream</a> result;</div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordflow">try</span></div>
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> {</div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> result = await localDownloadTask;</div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">catch</span></div>
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> {</div>
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="comment">// Unsightly yes, but, if we're here, that means someone called GetResult. So, either they handled the error or decided to ignore it</span></div>
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">return</span>;</div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> }</div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> await result.DisposeAsync();</div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> }</div>
|
|
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
|
|
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a>.<a class="code hl_function" href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html#a19c93b6b214a64529d9c7bf61ed28a2d">Dispose</a>();</div>
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a>.Dispose();</div>
|
|
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
|
|
<div class="foldopen" id="foldopen00093" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#afd6294b767b298ace3b91aef1accc5f6"> 93</a></span> <span class="keyword">public</span> async ValueTask<Stream> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#afd6294b767b298ace3b91aef1accc5f6">GetResult</a>(CancellationToken cancellationToken)</div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> {</div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6">disposed</a>)</div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> ObjectDisposedException(nameof(<a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html">RequestFileStreamProvider</a>));</div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> </div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> Task<CachedResponseStream> localTask;</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">using</span> (cancellationToken.Register(() => <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>.Cancel()))</div>
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> {</div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> lock (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>)</div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> {</div>
|
|
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">downloadTask</a> ??= <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a7c0e96de0b1928972f549ab0d2df882f">InitiateDownload</a>(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">downloadCts</a>.Token);</div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> localTask = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">downloadTask</a>;</div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> }</div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">return</span> await localTask;</div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> }</div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
|
|
<div class="foldopen" id="foldopen00116" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a7c0e96de0b1928972f549ab0d2df882f"> 116</a></span> async Task<CachedResponseStream> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a7c0e96de0b1928972f549ab0d2df882f">InitiateDownload</a>(CancellationToken cancellationToken)</div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> {</div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> var response = await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">httpClient</a>.SendAsync(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">requestMessage</a>, HttpCompletionOption.ResponseHeadersRead, cancellationToken);</div>
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordflow">try</span></div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> {</div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> response.EnsureSuccessStatusCode();</div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">return</span> await <a class="code hl_class" href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html">CachedResponseStream</a>.<a class="code hl_function" href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html#a1c106673ce3f96456822b62e75b06774">Create</a>(response);</div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> }</div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">catch</span></div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> {</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> response.Dispose();</div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">throw</span>;</div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> }</div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> }</div>
|
|
</div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span>}</div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html">Tgstation.Server.Common.Http.CachedResponseStream</a></div><div class="ttdoc">Caches the Stream from a HttpResponseMessage for later use.</div><div class="ttdef"><b>Definition</b> <a href="_cached_response_stream_8cs_source.html#l00011">CachedResponseStream.cs:12</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream_html_a19c93b6b214a64529d9c7bf61ed28a2d"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html#a19c93b6b214a64529d9c7bf61ed28a2d">Tgstation.Server.Common.Http.CachedResponseStream.Dispose</a></div><div class="ttdeci">override void Dispose(bool disposing)</div><div class="ttdef"><b>Definition</b> <a href="_cached_response_stream_8cs_source.html#l00086">CachedResponseStream.cs:86</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream_html_a1c106673ce3f96456822b62e75b06774"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_common_1_1_http_1_1_cached_response_stream.html#a1c106673ce3f96456822b62e75b06774">Tgstation.Server.Common.Http.CachedResponseStream.Create</a></div><div class="ttdeci">static async ValueTask< CachedResponseStream > Create(HttpResponseMessage response)</div><div class="ttdoc">Asyncronously creates a new CachedResponseStream.</div><div class="ttdef"><b>Definition</b> <a href="_cached_response_stream_8cs_source.html#l00028">CachedResponseStream.cs:28</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html">Tgstation.Server.Host.IO.RequestFileStreamProvider</a></div><div class="ttdoc">A IFileStreamProvider that represents the response of HttpRequestMessages.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00014">RequestFileStreamProvider.cs:15</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_a0c88c8c83092a3cd993795ed781ce6e6"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a0c88c8c83092a3cd993795ed781ce6e6">Tgstation.Server.Host.IO.RequestFileStreamProvider.disposed</a></div><div class="ttdeci">volatile bool disposed</div><div class="ttdoc">If DisposeAsync has been called.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00039">RequestFileStreamProvider.cs:39</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_a5b03bbc5a4550a57565b56ec149f8011"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5b03bbc5a4550a57565b56ec149f8011">Tgstation.Server.Host.IO.RequestFileStreamProvider.downloadTask</a></div><div class="ttdeci">Task< CachedResponseStream >? downloadTask</div><div class="ttdoc">The Task<TResult> resulting in the downloaded MemoryStream.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00034">RequestFileStreamProvider.cs:34</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_a5c9a0890384f6c881deaee92e71ac71b"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a5c9a0890384f6c881deaee92e71ac71b">Tgstation.Server.Host.IO.RequestFileStreamProvider.RequestFileStreamProvider</a></div><div class="ttdeci">RequestFileStreamProvider(HttpClient httpClient, HttpRequestMessage requestMessage)</div><div class="ttdoc">Initializes a new instance of the RequestFileStreamProvider class.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00046">RequestFileStreamProvider.cs:46</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_a6f9f9b65bfc0972858e335f614aa0d26"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a6f9f9b65bfc0972858e335f614aa0d26">Tgstation.Server.Host.IO.RequestFileStreamProvider.downloadCts</a></div><div class="ttdeci">readonly CancellationTokenSource downloadCts</div><div class="ttdoc">The CancellationTokenSource used to abort the download.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00029">RequestFileStreamProvider.cs:29</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_a7c0e96de0b1928972f549ab0d2df882f"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#a7c0e96de0b1928972f549ab0d2df882f">Tgstation.Server.Host.IO.RequestFileStreamProvider.InitiateDownload</a></div><div class="ttdeci">async Task< CachedResponseStream > InitiateDownload(CancellationToken cancellationToken)</div><div class="ttdoc">Initiate the download.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00116">RequestFileStreamProvider.cs:116</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_ade17b8eab923e1c7fae00a02b32413c6"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#ade17b8eab923e1c7fae00a02b32413c6">Tgstation.Server.Host.IO.RequestFileStreamProvider.requestMessage</a></div><div class="ttdeci">readonly HttpRequestMessage requestMessage</div><div class="ttdoc">The IFileDownloader for the RequestFileStreamProvider.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00024">RequestFileStreamProvider.cs:24</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_adfebdd6a5c3af8ed387cf6cb313614aa"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#adfebdd6a5c3af8ed387cf6cb313614aa">Tgstation.Server.Host.IO.RequestFileStreamProvider.httpClient</a></div><div class="ttdeci">readonly HttpClient httpClient</div><div class="ttdoc">The HttpClient for the RequestFileStreamProvider.</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00019">RequestFileStreamProvider.cs:19</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_af1560622a7d79f2207f23c3cfcaf88a5"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#af1560622a7d79f2207f23c3cfcaf88a5">Tgstation.Server.Host.IO.RequestFileStreamProvider.DisposeAsync</a></div><div class="ttdeci">async ValueTask DisposeAsync()</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00055">RequestFileStreamProvider.cs:55</a></div></div>
|
|
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider_html_afd6294b767b298ace3b91aef1accc5f6"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_request_file_stream_provider.html#afd6294b767b298ace3b91aef1accc5f6">Tgstation.Server.Host.IO.RequestFileStreamProvider.GetResult</a></div><div class="ttdeci">async ValueTask< Stream > GetResult(CancellationToken cancellationToken)</div><div class="ttdoc">Gets the provided Stream. May be called multiple times, though cancelling any may cause all calls to ...</div><div class="ttdef"><b>Definition</b> <a href="_request_file_stream_provider_8cs_source.html#l00093">RequestFileStreamProvider.cs:93</a></div></div>
|
|
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_file_stream_provider_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_i_file_stream_provider.html">Tgstation.Server.Host.IO.IFileStreamProvider</a></div><div class="ttdoc">Interface for asynchronously consuming Streams of files.</div><div class="ttdef"><b>Definition</b> <a href="_i_file_stream_provider_8cs_source.html#l00011">IFileStreamProvider.cs:12</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_common_1_1_http_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_common_1_1_http.html">Tgstation.Server.Common.Http</a></div><div class="ttdef"><b>Definition</b> <a href="_cached_response_stream_8cs_source.html#l00006">CachedResponseStream.cs:7</a></div></div>
|
|
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_i_o_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a></div><div class="ttdef"><b>Definition</b> <a href="_buffered_file_stream_provider_8cs_source.html#l00008">BufferedFileStreamProvider.cs:9</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
|
|
</small></address>
|
|
</body>
|
|
</html>
|