-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find old external-vhost-servers and terminate it when running new (#1561
) * Find old external-vhost-servers and terminate it when running new * New config parameter VhostServerTimeoutAfterParentExit * Fix test * Try fix test * Fix review issues * Kill instead of terminate. * Fix test * It is possible that several endpoints for one diskId * Ignore all params before --disk-id * Make parsing disk-id simple
- Loading branch information
Showing
11 changed files
with
456 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
cloud/blockstore/libs/endpoints_vhost/cont_io_with_timeout.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
|
||
#include <library/cpp/coroutine/engine/sockpool.h> | ||
|
||
#include <util/stream/input.h> | ||
#include <util/stream/output.h> | ||
|
||
namespace NCloud::NBlockStore::NServer { | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
// Similar to TContIO, but DoWrite() and DoRead() operations are executed with a | ||
// timeout. | ||
class TContIOWithTimeout | ||
: public IInputStream | ||
, public IOutputStream | ||
{ | ||
SOCKET Fd_; | ||
TCont* Cont_; | ||
TDuration Timeout; | ||
|
||
public: | ||
TContIOWithTimeout(SOCKET fd, TCont* cont, TDuration timeout) | ||
: Fd_(fd) | ||
, Cont_(cont) | ||
, Timeout(timeout) | ||
{} | ||
|
||
void DoWrite(const void* buf, size_t len) override | ||
{ | ||
NCoro::WriteD(Cont_, Fd_, buf, len, TInstant::Now() + Timeout) | ||
.Checked(); | ||
} | ||
|
||
size_t DoRead(void* buf, size_t len) override | ||
{ | ||
return NCoro::ReadD(Cont_, Fd_, buf, len, TInstant::Now() + Timeout) | ||
.Checked(); | ||
} | ||
|
||
SOCKET Fd() const noexcept | ||
{ | ||
return Fd_; | ||
} | ||
}; | ||
|
||
} // namespace NCloud::NBlockStore::NServer |
Oops, something went wrong.