Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RF] Fix pserv.C and pclient.C tutorials #13357

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions net/net/inc/TPServerSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
// //
//////////////////////////////////////////////////////////////////////////

#include "TPSocket.h"
#include "TServerSocket.h"

class TPSocket;


class TPServerSocket : public TServerSocket {

private:
Expand All @@ -48,7 +46,7 @@ class TPServerSocket : public TServerSocket {

virtual ~TPServerSocket() {}

TSocket *Accept(UChar_t Opt = kSrvNoAuth) override;
TPSocket *Accept(UChar_t Opt = kSrvNoAuth) override;

ClassDefOverride(TPServerSocket,0) // Parallel server socket
};
Expand Down
20 changes: 10 additions & 10 deletions net/net/inc/TPSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class TPSocket : public TSocket {
friend class TPServerSocket;

private:
TSocket **fSockets; // array of parallel sockets
TMonitor *fWriteMonitor; // monitor write on parallel sockets
TMonitor *fReadMonitor; // monitor read from parallel sockets
Int_t fSize; // number of parallel sockets
Int_t *fWriteBytesLeft; // bytes left to write for specified socket
Int_t *fReadBytesLeft; // bytes left to read for specified socket
char **fWritePtr; // pointer to write buffer for specified socket
char **fReadPtr; // pointer to read buffer for specified socket
TSocket **fSockets = nullptr; // array of parallel sockets
TMonitor *fWriteMonitor = nullptr; // monitor write on parallel sockets
TMonitor *fReadMonitor = nullptr; // monitor read from parallel sockets
Int_t fSize; // number of parallel sockets
Int_t *fWriteBytesLeft = nullptr; // bytes left to write for specified socket
Int_t *fReadBytesLeft = nullptr; // bytes left to read for specified socket
char **fWritePtr = nullptr; // pointer to write buffer for specified socket
char **fReadPtr = nullptr; // pointer to read buffer for specified socket

TPSocket(TSocket *pSockets[], Int_t size);
TPSocket(const TPSocket &) = delete;
Expand All @@ -69,12 +69,12 @@ friend class TPServerSocket;
Int_t Send(Int_t kind) override { return TSocket::Send(kind); }
Int_t Send(Int_t status, Int_t kind) override { return TSocket::Send(status, kind); }
Int_t Send(const char *mess, Int_t kind = kMESS_STRING) override { return TSocket::Send(mess, kind); }
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt) override;
Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;
Int_t Recv(TMessage *&mess) override;
Int_t Recv(Int_t &status, Int_t &kind) override { return TSocket::Recv(status, kind); }
Int_t Recv(char *mess, Int_t max) override { return TSocket::Recv(mess, max); }
Int_t Recv(char *mess, Int_t max, Int_t &kind) override { return TSocket::Recv(mess, max, kind); }
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt) override;
Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt = kDefault) override;

Bool_t IsValid() const override { return fSockets ? kTRUE : kFALSE; }
Int_t GetErrorCode() const;
Expand Down
3 changes: 1 addition & 2 deletions net/net/src/TPServerSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
//////////////////////////////////////////////////////////////////////////

#include "TPServerSocket.h"
#include "TPSocket.h"
#include "TROOT.h"
#include "TVirtualMutex.h"

Expand Down Expand Up @@ -93,7 +92,7 @@ TPServerSocket::TPServerSocket(const char *service, Bool_t reuse, Int_t backlog,
/// In case of error 0 is returned and in case non-blocking I/O is
/// enabled and no connections are available -1 is returned.

TSocket *TPServerSocket::Accept(UChar_t Opt)
TPSocket *TPServerSocket::Accept(UChar_t Opt)
{
TSocket *setupSocket = 0;
TSocket **pSockets;
Expand Down
9 changes: 0 additions & 9 deletions net/net/src/TPSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ TPSocket::TPSocket(const char *host, Int_t port, Int_t size,
Int_t tcpwindowsize)
: TSocket(host, port, (Int_t)(size > 1 ? -1 : tcpwindowsize))
{
// To avoid uninitialization problems when Init is not called ...
fSockets = 0;
fWriteMonitor = 0;
fReadMonitor = 0;
fWriteBytesLeft = 0;
fReadBytesLeft = 0;
fWritePtr = 0;
fReadPtr = 0;

// set to the real value only at end (except for old servers)
fSize = 1;

Expand Down
2 changes: 1 addition & 1 deletion net/net/src/TSocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ Int_t TSocket::Send(const TMessage &mess)
{
TSystem::ResetErrno();

if (!IsValid()) return -1;
if (fSocket < 0) return -1;

if (mess.IsReading()) {
Error("Send", "cannot send a message used for reading");
Expand Down
Loading