xref: /haiku/src/add-ons/kernel/file_systems/netfs/shared/RequestHandler.cpp (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 // RequestHandler.cpp
2 
3 #include "Compatibility.h"
4 #include "RequestHandler.h"
5 
6 // constructor
7 RequestHandler::RequestHandler()
8 	: RequestVisitor(),
9 	  fChannels()
10 {
11 }
12 
13 // destructor
14 RequestHandler::~RequestHandler()
15 {
16 }
17 
18 // HandleRequest
19 status_t
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
33 RequestHandler::VisitAny(Request* request)
34 {
35 	// unexpected request
36 	return B_BAD_DATA;
37 }
38 
39 // GetChannel
40 RequestChannel*
41 RequestHandler::GetChannel() const
42 {
43 	return (RequestChannel*)fChannels.Get();
44 }
45 
46