xref: /haiku/src/add-ons/kernel/file_systems/netfs/shared/RequestHandler.cpp (revision 5a1d355fdf2747f80f8c46e2539f844a0b813346)
1 // RequestHandler.cpp
2 
3 #include "Compatibility.h"
4 #include "RequestHandler.h"
5 
6 // constructor
RequestHandler()7 RequestHandler::RequestHandler()
8 	: RequestVisitor(),
9 	  fChannels()
10 {
11 }
12 
13 // destructor
~RequestHandler()14 RequestHandler::~RequestHandler()
15 {
16 }
17 
18 // HandleRequest
19 status_t
HandleRequest(Request * request,RequestChannel * channel)20 RequestHandler::HandleRequest(Request* request, RequestChannel* channel)
21 {
22 	if (!request)
23 		return B_BAD_VALUE;
24 	status_t error = fChannels.Set(channel);
25 	if (error != B_OK)
26 		return error;
27 	ThreadLocalUnsetter _(fChannels);
28 	return request->Accept(this);
29 }
30 
31 // VisitAny
32 status_t
VisitAny(Request * request)33 RequestHandler::VisitAny(Request* request)
34 {
35 	// unexpected request
36 	return B_BAD_DATA;
37 }
38 
39 // GetChannel
40 RequestChannel*
GetChannel() const41 RequestHandler::GetChannel() const
42 {
43 	return (RequestChannel*)fChannels.Get();
44 }
45 
46