// @(#)root/net:$Id$
// Author: Fons Rademakers   18/12/96

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TServerSocket                                                        //
//                                                                      //
// This class implements server sockets. A server socket waits for      //
// requests to come in over the network. It performs some operation     //
// based on that request and then possibly returns a full duplex socket //
// to the requester. The actual work is done via the TSystem class      //
// (either TUnixSystem or TWinNTSystem).                                //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TServerSocket.h"
#include "TSocket.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TError.h"
#include <string>
#include "TVirtualMutex.h"

// Hook to server authentication wrapper
SrvAuth_t TServerSocket::fgSrvAuthHook = 0;
SrvClup_t TServerSocket::fgSrvAuthClupHook = 0;

// Defaul options for accept
UChar_t TServerSocket::fgAcceptOpt = kSrvNoAuth;

TVirtualMutex *gSrvAuthenticateMutex = 0;

ClassImp(TServerSocket)

//______________________________________________________________________________
static void SetAuthOpt(UChar_t &opt, UChar_t mod)
{
   // Kind of macro to parse input options
   // Modify opt according to modifier mod.

   R__LOCKGUARD2(gSrvAuthenticateMutex);

   if (!mod) return;

   if ((mod & kSrvAuth))   opt |= kSrvAuth;
   if ((mod & kSrvNoAuth)) opt &= ~kSrvAuth;
}

//______________________________________________________________________________
TServerSocket::TServerSocket(const char *service, Bool_t reuse, Int_t backlog,
                             Int_t tcpwindowsize)
{
   // Create a server socket object for a named service. Set reuse to true
   // to force reuse of the server socket (i.e. do not wait for the time
   // out to pass). Using backlog one can set the desirable queue length
   // for pending connections.
   // Use tcpwindowsize to specify the size of the receive buffer, it has
   // to be specified here to make sure the window scale option is set (for
   // tcpwindowsize > 65KB and for platforms supporting window scaling).
   // Use IsValid() to check the validity of the
   // server socket. In case server socket is not valid use GetErrorCode()
   // to obtain the specific error value. These values are:
   //  0 = no error (socket is valid)
   // -1 = low level socket() call failed
   // -2 = low level bind() call failed
   // -3 = low level listen() call failed
   // Every valid server socket is added to the TROOT sockets list which
   // will make sure that any open sockets are properly closed on
   // program termination.

   R__ASSERT(gROOT);
   R__ASSERT(gSystem);

   SetName("ServerSocket");

   fSecContext = 0;
   fSecContexts = new TList;

   // If this is a local path, try announcing a UNIX socket service
   ResetBit(TSocket::kIsUnix);
   if (service && (!gSystem->AccessPathName(service) ||
#ifndef WIN32
      service[0] == '/')) {
#else
      service[0] == '/' || (service[1] == ':' && service[2] == '/'))) {
#endif
      SetBit(TSocket::kIsUnix);
      fService = "unix:";
      fService += service;
      fSocket = gSystem->AnnounceUnixService(service, backlog);
      if (fSocket >= 0) {
         R__LOCKGUARD2(gROOTMutex);
         gROOT->GetListOfSockets()->Add(this);
      }
   } else {
      // TCP / UDP socket
      fService = service;
      int port = gSystem->GetServiceByName(service);
      if (port != -1) {
         fSocket = gSystem->AnnounceTcpService(port, reuse, backlog, tcpwindowsize);
         if (fSocket >= 0) {
            R__LOCKGUARD2(gROOTMutex);
            gROOT->GetListOfSockets()->Add(this);
         }
      } else {
         fSocket = -1;
      }
   }
}

//______________________________________________________________________________
TServerSocket::TServerSocket(Int_t port, Bool_t reuse, Int_t backlog,
                             Int_t tcpwindowsize)
{
   // Create a server socket object on a specified port. Set reuse to true
   // to force reuse of the server socket (i.e. do not wait for the time
   // out to pass). Using backlog one can set the desirable queue length
   // for pending connections. If port is 0 a port scan will be done to
   // find a free port. This option is mutual exlusive with the reuse option.
   // Use tcpwindowsize to specify the size of the receive buffer, it has
   // to be specified here to make sure the window scale option is set (for
   // tcpwindowsize > 65KB and for platforms supporting window scaling).
   // Use IsValid() to check the validity of the
   // server socket. In case server socket is not valid use GetErrorCode()
   // to obtain the specific error value. These values are:
   //  0 = no error (socket is valid)
   // -1 = low level socket() call failed
   // -2 = low level bind() call failed
   // -3 = low level listen() call failed
   // Every valid server socket is added to the TROOT sockets list which
   // will make sure that any open sockets are properly closed on
   // program termination.

   R__ASSERT(gROOT);
   R__ASSERT(gSystem);

   SetName("ServerSocket");

   fSecContext = 0;
   fSecContexts = new TList;
   fService = gSystem->GetServiceByPort(port);
   SetTitle(fService);

   fSocket = gSystem->AnnounceTcpService(port, reuse, backlog, tcpwindowsize);
   if (fSocket >= 0) {
      R__LOCKGUARD2(gROOTMutex);
      gROOT->GetListOfSockets()->Add(this);
   }
}

//______________________________________________________________________________
TServerSocket::~TServerSocket()
{
   // Destructor: cleanup authentication stuff (if any) and close

   R__LOCKGUARD2(gSrvAuthenticateMutex);
   if (fSecContexts) {
      if (fgSrvAuthClupHook) {
         // Cleanup the security contexts
         (*fgSrvAuthClupHook)(fSecContexts);
      }
      // Remove the list
      fSecContexts->Delete();
      SafeDelete(fSecContexts);
      fSecContexts = 0;
   }

   Close();
}

//______________________________________________________________________________
TSocket *TServerSocket::Accept(UChar_t opt)
{
   // Accept a connection on a server socket. Returns a full-duplex
   // communication TSocket object. If no pending connections are
   // present on the queue and nonblocking mode has not been enabled
   // with SetOption(kNoBlock,1) the call blocks until a connection is
   // present. The returned socket must be deleted by the user. The socket
   // is also added to the TROOT sockets list which will make sure that
   // any open sockets are properly closed on program termination.
   // In case of error 0 is returned and in case non-blocking I/O is
   // enabled and no connections are available -1 is returned.
   //
   // The opt can be used to require client authentication; valid options are
   //
   //    kSrvAuth   =   require client authentication
   //    kSrvNoAuth =   force no client authentication
   //
   // Example: use Opt = kSrvAuth to require client authentication.
   //
   // Default options are taken from fgAcceptOpt and are initially
   // equivalent to kSrvNoAuth; they can be changed with the static
   // method TServerSocket::SetAcceptOptions(Opt).
   // The active defaults can be visualized using the static method
   // TServerSocket::ShowAcceptOptions().
   //

   if (fSocket == -1) { return 0; }

   TSocket *socket = new TSocket;

   Int_t soc = gSystem->AcceptConnection(fSocket);
   if (soc == -1) { delete socket; return 0; }
   if (soc == -2) { delete socket; return (TSocket*) -1; }

   // Parse Opt
   UChar_t acceptOpt = fgAcceptOpt;
   SetAuthOpt(acceptOpt, opt);
   Bool_t auth = (Bool_t)(acceptOpt & kSrvAuth);

   socket->fSocket  = soc;
   socket->fSecContext = 0;
   socket->fService = fService;
   if (!TestBit(TSocket::kIsUnix))
      socket->fAddress = gSystem->GetPeerName(socket->fSocket);
   if (socket->fSocket >= 0) {
      R__LOCKGUARD2(gROOTMutex);
      gROOT->GetListOfSockets()->Add(socket);
   }

   // Perform authentication, if required
   if (auth) {
      if (!Authenticate(socket)) {
         delete socket;
         socket = 0;
      }
   }

   return socket;
}

//______________________________________________________________________________
TInetAddress TServerSocket::GetLocalInetAddress()
{
   // Return internet address of host to which the server socket is bound,
   // i.e. the local host. In case of error TInetAddress::IsValid() returns
   // kFALSE.

   if (fSocket != -1) {
      if (fAddress.GetPort() == -1)
         fAddress = gSystem->GetSockName(fSocket);
      return fAddress;
   }
   return TInetAddress();
}

//______________________________________________________________________________
Int_t TServerSocket::GetLocalPort()
{
   // Get port # to which server socket is bound. In case of error returns -1.

   if (fSocket != -1) {
      if (fAddress.GetPort() == -1)
         fAddress = GetLocalInetAddress();
      return fAddress.GetPort();
   }
   return -1;
}


//______________________________________________________________________________
UChar_t TServerSocket::GetAcceptOptions()
{
   // Return default options for Accept

   return fgAcceptOpt;
}

//______________________________________________________________________________
void TServerSocket::SetAcceptOptions(UChar_t mod)
{
   // Set default options for Accept according to modifier 'mod'.
   // Use:
   //   kSrvAuth                 require client authentication
   //   kSrvNoAuth               do not require client authentication

   SetAuthOpt(fgAcceptOpt, mod);
}

//______________________________________________________________________________
void TServerSocket::ShowAcceptOptions()
{
   // Print default options for Accept.

   ::Info("ShowAcceptOptions", "Use authentication: %s", (fgAcceptOpt & kSrvAuth) ? "yes" : "no");
}

//______________________________________________________________________________
Bool_t TServerSocket::Authenticate(TSocket *sock)
{
   // Check authentication request from the client on new
   // open connection

   if (!fgSrvAuthHook) {
      R__LOCKGUARD2(gSrvAuthenticateMutex);

      // Load libraries needed for (server) authentication ...
      TString srvlib = "libSrvAuth";
      char *p = 0;
      // The generic one
      if ((p = gSystem->DynamicPathName(srvlib, kTRUE))) {
         delete[] p;
         if (gSystem->Load(srvlib) == -1) {
            Error("Authenticate", "can't load %s",srvlib.Data());
            return kFALSE;
         }
      } else {
         Error("Authenticate", "can't locate %s",srvlib.Data());
         return kFALSE;
      }
      //
      // Locate SrvAuthenticate
      Func_t f = gSystem->DynFindSymbol(srvlib,"SrvAuthenticate");
      if (f)
         fgSrvAuthHook = (SrvAuth_t)(f);
      else {
         Error("Authenticate", "can't find SrvAuthenticate");
         return kFALSE;
      }
      //
      // Locate SrvAuthCleanup
      f = gSystem->DynFindSymbol(srvlib,"SrvAuthCleanup");
      if (f)
         fgSrvAuthClupHook = (SrvClup_t)(f);
      else {
         Warning("Authenticate", "can't find SrvAuthCleanup");
      }
   }

   TString confdir;
#ifndef ROOTPREFIX
   // try to guess the config directory...
   if (gSystem->Getenv("ROOTSYS")) {
      confdir = TString(gSystem->Getenv("ROOTSYS"));
   } else {
      // Try to guess it from 'root.exe' path
      char *rootexe = gSystem->Which(gSystem->Getenv("PATH"),
                                     "root.exe", kExecutePermission);
      confdir = rootexe;
      confdir.Resize(confdir.Last('/'));
      delete [] rootexe;
   }
#else
   confdir = TString(ROOTPREFIX);
#endif
   if (!confdir.Length()) {
      Error("Authenticate", "config dir undefined");
      return kFALSE;
   }

   // dir for temporary files
   TString tmpdir = TString(gSystem->TempDirectory());
   if (gSystem->AccessPathName(tmpdir, kWritePermission))
      tmpdir = TString("/tmp");

   // Get Host name
   TString openhost(sock->GetInetAddress().GetHostName());
   if (gDebug > 2)
      Info("Authenticate","OpenHost = %s", openhost.Data());

   // Run Authentication now
   std::string user;
   Int_t meth = -1;
   Int_t auth = 0;
   Int_t type = 0;
   std::string ctkn = "";
   if (fgSrvAuthHook)
      auth = (*fgSrvAuthHook)(sock, confdir, tmpdir, user,
                              meth, type, ctkn, fSecContexts);

   if (gDebug > 2)
      Info("Authenticate","auth = %d, type= %d, ctkn= %s",
            auth, type, ctkn.c_str());

   return auth;
}
 TServerSocket.cxx:1
 TServerSocket.cxx:2
 TServerSocket.cxx:3
 TServerSocket.cxx:4
 TServerSocket.cxx:5
 TServerSocket.cxx:6
 TServerSocket.cxx:7
 TServerSocket.cxx:8
 TServerSocket.cxx:9
 TServerSocket.cxx:10
 TServerSocket.cxx:11
 TServerSocket.cxx:12
 TServerSocket.cxx:13
 TServerSocket.cxx:14
 TServerSocket.cxx:15
 TServerSocket.cxx:16
 TServerSocket.cxx:17
 TServerSocket.cxx:18
 TServerSocket.cxx:19
 TServerSocket.cxx:20
 TServerSocket.cxx:21
 TServerSocket.cxx:22
 TServerSocket.cxx:23
 TServerSocket.cxx:24
 TServerSocket.cxx:25
 TServerSocket.cxx:26
 TServerSocket.cxx:27
 TServerSocket.cxx:28
 TServerSocket.cxx:29
 TServerSocket.cxx:30
 TServerSocket.cxx:31
 TServerSocket.cxx:32
 TServerSocket.cxx:33
 TServerSocket.cxx:34
 TServerSocket.cxx:35
 TServerSocket.cxx:36
 TServerSocket.cxx:37
 TServerSocket.cxx:38
 TServerSocket.cxx:39
 TServerSocket.cxx:40
 TServerSocket.cxx:41
 TServerSocket.cxx:42
 TServerSocket.cxx:43
 TServerSocket.cxx:44
 TServerSocket.cxx:45
 TServerSocket.cxx:46
 TServerSocket.cxx:47
 TServerSocket.cxx:48
 TServerSocket.cxx:49
 TServerSocket.cxx:50
 TServerSocket.cxx:51
 TServerSocket.cxx:52
 TServerSocket.cxx:53
 TServerSocket.cxx:54
 TServerSocket.cxx:55
 TServerSocket.cxx:56
 TServerSocket.cxx:57
 TServerSocket.cxx:58
 TServerSocket.cxx:59
 TServerSocket.cxx:60
 TServerSocket.cxx:61
 TServerSocket.cxx:62
 TServerSocket.cxx:63
 TServerSocket.cxx:64
 TServerSocket.cxx:65
 TServerSocket.cxx:66
 TServerSocket.cxx:67
 TServerSocket.cxx:68
 TServerSocket.cxx:69
 TServerSocket.cxx:70
 TServerSocket.cxx:71
 TServerSocket.cxx:72
 TServerSocket.cxx:73
 TServerSocket.cxx:74
 TServerSocket.cxx:75
 TServerSocket.cxx:76
 TServerSocket.cxx:77
 TServerSocket.cxx:78
 TServerSocket.cxx:79
 TServerSocket.cxx:80
 TServerSocket.cxx:81
 TServerSocket.cxx:82
 TServerSocket.cxx:83
 TServerSocket.cxx:84
 TServerSocket.cxx:85
 TServerSocket.cxx:86
 TServerSocket.cxx:87
 TServerSocket.cxx:88
 TServerSocket.cxx:89
 TServerSocket.cxx:90
 TServerSocket.cxx:91
 TServerSocket.cxx:92
 TServerSocket.cxx:93
 TServerSocket.cxx:94
 TServerSocket.cxx:95
 TServerSocket.cxx:96
 TServerSocket.cxx:97
 TServerSocket.cxx:98
 TServerSocket.cxx:99
 TServerSocket.cxx:100
 TServerSocket.cxx:101
 TServerSocket.cxx:102
 TServerSocket.cxx:103
 TServerSocket.cxx:104
 TServerSocket.cxx:105
 TServerSocket.cxx:106
 TServerSocket.cxx:107
 TServerSocket.cxx:108
 TServerSocket.cxx:109
 TServerSocket.cxx:110
 TServerSocket.cxx:111
 TServerSocket.cxx:112
 TServerSocket.cxx:113
 TServerSocket.cxx:114
 TServerSocket.cxx:115
 TServerSocket.cxx:116
 TServerSocket.cxx:117
 TServerSocket.cxx:118
 TServerSocket.cxx:119
 TServerSocket.cxx:120
 TServerSocket.cxx:121
 TServerSocket.cxx:122
 TServerSocket.cxx:123
 TServerSocket.cxx:124
 TServerSocket.cxx:125
 TServerSocket.cxx:126
 TServerSocket.cxx:127
 TServerSocket.cxx:128
 TServerSocket.cxx:129
 TServerSocket.cxx:130
 TServerSocket.cxx:131
 TServerSocket.cxx:132
 TServerSocket.cxx:133
 TServerSocket.cxx:134
 TServerSocket.cxx:135
 TServerSocket.cxx:136
 TServerSocket.cxx:137
 TServerSocket.cxx:138
 TServerSocket.cxx:139
 TServerSocket.cxx:140
 TServerSocket.cxx:141
 TServerSocket.cxx:142
 TServerSocket.cxx:143
 TServerSocket.cxx:144
 TServerSocket.cxx:145
 TServerSocket.cxx:146
 TServerSocket.cxx:147
 TServerSocket.cxx:148
 TServerSocket.cxx:149
 TServerSocket.cxx:150
 TServerSocket.cxx:151
 TServerSocket.cxx:152
 TServerSocket.cxx:153
 TServerSocket.cxx:154
 TServerSocket.cxx:155
 TServerSocket.cxx:156
 TServerSocket.cxx:157
 TServerSocket.cxx:158
 TServerSocket.cxx:159
 TServerSocket.cxx:160
 TServerSocket.cxx:161
 TServerSocket.cxx:162
 TServerSocket.cxx:163
 TServerSocket.cxx:164
 TServerSocket.cxx:165
 TServerSocket.cxx:166
 TServerSocket.cxx:167
 TServerSocket.cxx:168
 TServerSocket.cxx:169
 TServerSocket.cxx:170
 TServerSocket.cxx:171
 TServerSocket.cxx:172
 TServerSocket.cxx:173
 TServerSocket.cxx:174
 TServerSocket.cxx:175
 TServerSocket.cxx:176
 TServerSocket.cxx:177
 TServerSocket.cxx:178
 TServerSocket.cxx:179
 TServerSocket.cxx:180
 TServerSocket.cxx:181
 TServerSocket.cxx:182
 TServerSocket.cxx:183
 TServerSocket.cxx:184
 TServerSocket.cxx:185
 TServerSocket.cxx:186
 TServerSocket.cxx:187
 TServerSocket.cxx:188
 TServerSocket.cxx:189
 TServerSocket.cxx:190
 TServerSocket.cxx:191
 TServerSocket.cxx:192
 TServerSocket.cxx:193
 TServerSocket.cxx:194
 TServerSocket.cxx:195
 TServerSocket.cxx:196
 TServerSocket.cxx:197
 TServerSocket.cxx:198
 TServerSocket.cxx:199
 TServerSocket.cxx:200
 TServerSocket.cxx:201
 TServerSocket.cxx:202
 TServerSocket.cxx:203
 TServerSocket.cxx:204
 TServerSocket.cxx:205
 TServerSocket.cxx:206
 TServerSocket.cxx:207
 TServerSocket.cxx:208
 TServerSocket.cxx:209
 TServerSocket.cxx:210
 TServerSocket.cxx:211
 TServerSocket.cxx:212
 TServerSocket.cxx:213
 TServerSocket.cxx:214
 TServerSocket.cxx:215
 TServerSocket.cxx:216
 TServerSocket.cxx:217
 TServerSocket.cxx:218
 TServerSocket.cxx:219
 TServerSocket.cxx:220
 TServerSocket.cxx:221
 TServerSocket.cxx:222
 TServerSocket.cxx:223
 TServerSocket.cxx:224
 TServerSocket.cxx:225
 TServerSocket.cxx:226
 TServerSocket.cxx:227
 TServerSocket.cxx:228
 TServerSocket.cxx:229
 TServerSocket.cxx:230
 TServerSocket.cxx:231
 TServerSocket.cxx:232
 TServerSocket.cxx:233
 TServerSocket.cxx:234
 TServerSocket.cxx:235
 TServerSocket.cxx:236
 TServerSocket.cxx:237
 TServerSocket.cxx:238
 TServerSocket.cxx:239
 TServerSocket.cxx:240
 TServerSocket.cxx:241
 TServerSocket.cxx:242
 TServerSocket.cxx:243
 TServerSocket.cxx:244
 TServerSocket.cxx:245
 TServerSocket.cxx:246
 TServerSocket.cxx:247
 TServerSocket.cxx:248
 TServerSocket.cxx:249
 TServerSocket.cxx:250
 TServerSocket.cxx:251
 TServerSocket.cxx:252
 TServerSocket.cxx:253
 TServerSocket.cxx:254
 TServerSocket.cxx:255
 TServerSocket.cxx:256
 TServerSocket.cxx:257
 TServerSocket.cxx:258
 TServerSocket.cxx:259
 TServerSocket.cxx:260
 TServerSocket.cxx:261
 TServerSocket.cxx:262
 TServerSocket.cxx:263
 TServerSocket.cxx:264
 TServerSocket.cxx:265
 TServerSocket.cxx:266
 TServerSocket.cxx:267
 TServerSocket.cxx:268
 TServerSocket.cxx:269
 TServerSocket.cxx:270
 TServerSocket.cxx:271
 TServerSocket.cxx:272
 TServerSocket.cxx:273
 TServerSocket.cxx:274
 TServerSocket.cxx:275
 TServerSocket.cxx:276
 TServerSocket.cxx:277
 TServerSocket.cxx:278
 TServerSocket.cxx:279
 TServerSocket.cxx:280
 TServerSocket.cxx:281
 TServerSocket.cxx:282
 TServerSocket.cxx:283
 TServerSocket.cxx:284
 TServerSocket.cxx:285
 TServerSocket.cxx:286
 TServerSocket.cxx:287
 TServerSocket.cxx:288
 TServerSocket.cxx:289
 TServerSocket.cxx:290
 TServerSocket.cxx:291
 TServerSocket.cxx:292
 TServerSocket.cxx:293
 TServerSocket.cxx:294
 TServerSocket.cxx:295
 TServerSocket.cxx:296
 TServerSocket.cxx:297
 TServerSocket.cxx:298
 TServerSocket.cxx:299
 TServerSocket.cxx:300
 TServerSocket.cxx:301
 TServerSocket.cxx:302
 TServerSocket.cxx:303
 TServerSocket.cxx:304
 TServerSocket.cxx:305
 TServerSocket.cxx:306
 TServerSocket.cxx:307
 TServerSocket.cxx:308
 TServerSocket.cxx:309
 TServerSocket.cxx:310
 TServerSocket.cxx:311
 TServerSocket.cxx:312
 TServerSocket.cxx:313
 TServerSocket.cxx:314
 TServerSocket.cxx:315
 TServerSocket.cxx:316
 TServerSocket.cxx:317
 TServerSocket.cxx:318
 TServerSocket.cxx:319
 TServerSocket.cxx:320
 TServerSocket.cxx:321
 TServerSocket.cxx:322
 TServerSocket.cxx:323
 TServerSocket.cxx:324
 TServerSocket.cxx:325
 TServerSocket.cxx:326
 TServerSocket.cxx:327
 TServerSocket.cxx:328
 TServerSocket.cxx:329
 TServerSocket.cxx:330
 TServerSocket.cxx:331
 TServerSocket.cxx:332
 TServerSocket.cxx:333
 TServerSocket.cxx:334
 TServerSocket.cxx:335
 TServerSocket.cxx:336
 TServerSocket.cxx:337
 TServerSocket.cxx:338
 TServerSocket.cxx:339
 TServerSocket.cxx:340
 TServerSocket.cxx:341
 TServerSocket.cxx:342
 TServerSocket.cxx:343
 TServerSocket.cxx:344
 TServerSocket.cxx:345
 TServerSocket.cxx:346
 TServerSocket.cxx:347
 TServerSocket.cxx:348
 TServerSocket.cxx:349
 TServerSocket.cxx:350
 TServerSocket.cxx:351
 TServerSocket.cxx:352
 TServerSocket.cxx:353
 TServerSocket.cxx:354
 TServerSocket.cxx:355
 TServerSocket.cxx:356
 TServerSocket.cxx:357
 TServerSocket.cxx:358
 TServerSocket.cxx:359
 TServerSocket.cxx:360
 TServerSocket.cxx:361
 TServerSocket.cxx:362
 TServerSocket.cxx:363
 TServerSocket.cxx:364
 TServerSocket.cxx:365
 TServerSocket.cxx:366
 TServerSocket.cxx:367
 TServerSocket.cxx:368
 TServerSocket.cxx:369
 TServerSocket.cxx:370
 TServerSocket.cxx:371
 TServerSocket.cxx:372
 TServerSocket.cxx:373
 TServerSocket.cxx:374
 TServerSocket.cxx:375
 TServerSocket.cxx:376
 TServerSocket.cxx:377
 TServerSocket.cxx:378
 TServerSocket.cxx:379
 TServerSocket.cxx:380
 TServerSocket.cxx:381
 TServerSocket.cxx:382
 TServerSocket.cxx:383
 TServerSocket.cxx:384