source: XIOS/dev/dev_olga/src/server.cpp @ 1130

Last change on this file since 1130 was 1130, checked in by oabramkina, 7 years ago

Two-level server: merging new grid functionalities and changes in the communication protocol (e.g. non-blocking context finalize, registries, oasis).

Tests on curie: test_client, test_complete, nemo (test_xios2_cmip6.exe).

To do: non-structured grid, check reading, possible bug in client/server initialization (?).

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 21.6 KB
Line 
1#include "globalScopeData.hpp"
2#include "xios_spl.hpp"
3#include "cxios.hpp"
4#include "server.hpp"
5#include "client.hpp"
6#include "type.hpp"
7#include "context.hpp"
8#include "object_template.hpp"
9#include "oasis_cinterface.hpp"
10#include <boost/functional/hash.hpp>
11#include <boost/algorithm/string.hpp>
12#include "mpi.hpp"
13#include "tracer.hpp"
14#include "timer.hpp"
15#include "event_scheduler.hpp"
16
17namespace xios
18{
19    MPI_Comm CServer::intraComm ;
20    list<MPI_Comm> CServer::interCommLeft ;
21    list<MPI_Comm> CServer::interCommRight ;
22//    list<MPI_Comm> CServer::interComm ;
23    std::list<MPI_Comm> CServer::contextInterComms;
24    std::list<MPI_Comm> CServer::contextIntraComms;
25    int CServer::serverLevel = 0 ;
26    int CServer::serverLeader_ = 0;
27    int CServer::serverSize_ = 0;
28    int CServer::nbPools = 0;
29    int CServer::poolId = 0;
30    int CServer::nbContexts_ = 0;
31    bool CServer::isRoot = false ;
32    int CServer::rank_ = INVALID_RANK;
33    StdOFStream CServer::m_infoStream;
34    StdOFStream CServer::m_errorStream;
35    map<string,CContext*> CServer::contextList ;
36    bool CServer::finished=false ;
37    bool CServer::is_MPI_Initialized ;
38    CEventScheduler* CServer::eventScheduler = 0;
39
40//---------------------------------------------------------------
41/*!
42 * \fn void CServer::initialize(void)
43 * Creates intraComm for each possible type of servers (classical, primary or secondary).
44 * In case of secondary servers intraComm is created for each secondary server pool.
45 * (For now the assumption is that there is one proc per pool.)
46 * Creates the following lists of interComms:
47 *   classical server -- interCommLeft
48 *   primary server -- interCommLeft and interCommRight
49 *   secondary server -- interComm for each pool.
50 */
51    void CServer::initialize(void)
52    {
53      int initialized ;
54      MPI_Initialized(&initialized) ;
55      if (initialized) is_MPI_Initialized=true ;
56      else is_MPI_Initialized=false ;
57
58      // Not using OASIS
59      if (!CXios::usingOasis)
60      {
61
62        if (!is_MPI_Initialized)
63        {
64          MPI_Init(NULL, NULL);
65        }
66        CTimer::get("XIOS").resume() ;
67
68        boost::hash<string> hashString ;
69        unsigned long hashServer = hashString(CXios::xiosCodeId);
70
71        unsigned long* hashAll ;
72
73//        int rank ;
74        int size ;
75        int myColor ;
76        int i,c ;
77        MPI_Comm newComm, serversComm;
78
79        MPI_Comm_size(CXios::globalComm, &size) ;
80        MPI_Comm_rank(CXios::globalComm, &rank_);
81
82        hashAll=new unsigned long[size] ;
83        MPI_Allgather(&hashServer, 1, MPI_LONG, hashAll, 1, MPI_LONG, CXios::globalComm) ;
84
85        map<unsigned long, int> colors ;
86        map<unsigned long, int> leaders ;
87        map<unsigned long, int>::iterator it ;
88
89        for(i=0,c=0;i<size;i++)
90        {
91          if (colors.find(hashAll[i])==colors.end())
92          {
93            colors[hashAll[i]]=c ;
94            leaders[hashAll[i]]=i ;
95            c++ ;
96          }
97        }
98
99        // Setting the number of secondary pools
100        myColor = colors[hashServer];
101        if (CXios::usingServer2)
102        {
103          int serverRank = rank_ - leaders[hashServer]; // server proc rank starting 0
104          serverSize_ = size - leaders[hashServer];
105          nbPools = serverSize_ * CXios::ratioServer2 / 100;
106          if ( serverRank < (serverSize_ - nbPools) )
107          {
108            serverLevel = 1;
109          }
110          else
111          {
112            serverLevel = 2;
113            poolId = serverRank - serverSize_ + nbPools;
114            myColor = rank_;
115          }
116        }
117
118        MPI_Comm_split(CXios::globalComm, myColor, rank_, &intraComm) ;
119
120        if (serverLevel == 0)
121        {
122          int clientLeader;
123          for(it=leaders.begin();it!=leaders.end();it++)
124          {
125            if (it->first!=hashServer)
126            {
127              clientLeader=it->second ;
128              int intraCommSize, intraCommRank ;
129              MPI_Comm_size(intraComm,&intraCommSize) ;
130              MPI_Comm_rank(intraComm,&intraCommRank) ;
131              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
132                       <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
133
134              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
135               interCommLeft.push_back(newComm) ;
136            }
137          }
138        }
139        else if (serverLevel == 1)
140        {
141          int clientLeader, srvSndLeader;
142          int srvPrmLeader ;
143          for (it=leaders.begin();it!=leaders.end();it++)
144          {
145            if (it->first != hashServer)
146            {
147              clientLeader=it->second ;
148              int intraCommSize, intraCommRank ;
149              MPI_Comm_size(intraComm, &intraCommSize) ;
150              MPI_Comm_rank(intraComm, &intraCommRank) ;
151              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
152                       <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
153              MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
154              interCommLeft.push_back(newComm) ;
155            }
156            else
157              serverLeader_ = it->second;
158          }
159
160          for (int i = 0; i < nbPools; ++i)
161          {
162            srvSndLeader = serverLeader_ + serverSize_ - nbPools + i;
163            int intraCommSize, intraCommRank ;
164            MPI_Comm_size(intraComm, &intraCommSize) ;
165            MPI_Comm_rank(intraComm, &intraCommRank) ;
166            info(50)<<"intercommCreate::client "<<rank_<<" intraCommSize : "<<intraCommSize
167                <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< srvSndLeader<<endl ;
168            MPI_Intercomm_create(intraComm, 0, CXios::globalComm, srvSndLeader, 0, &newComm) ;
169            interCommRight.push_back(newComm) ;
170          }
171        } // primary server
172        else
173        {
174          int clientLeader;
175          clientLeader = leaders[hashString(CXios::xiosCodeId)];
176          int intraCommSize, intraCommRank ;
177          MPI_Comm_size(intraComm, &intraCommSize) ;
178          MPI_Comm_rank(intraComm, &intraCommRank) ;
179          info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<intraCommSize
180                   <<" intraCommRank :"<<intraCommRank<<"  clientLeader "<< clientLeader<<endl ;
181
182          MPI_Intercomm_create(intraComm, 0, CXios::globalComm, clientLeader, 0, &newComm) ;
183          interCommLeft.push_back(newComm) ;
184        } // secondary server
185
186        delete [] hashAll ;
187
188      }
189      // using OASIS
190      else
191      {
192        int size, rank;
193        int myColor;
194        if (!is_MPI_Initialized) oasis_init(CXios::xiosCodeId);
195
196        CTimer::get("XIOS").resume() ;
197        MPI_Comm localComm;
198        oasis_get_localcomm(localComm);
199
200        // Create server intraComm
201        if (!CXios::usingServer2)
202          MPI_Comm_dup(localComm, &intraComm);
203        else
204        {
205          MPI_Comm_rank(localComm,&rank) ;
206          MPI_Comm_size(localComm,&serverSize_) ;
207          nbPools = serverSize_ * CXios::ratioServer2 / 100;
208          if ( rank < (serverSize_ - nbPools) )
209          {
210            serverLevel = 1;
211            myColor = 0;
212          }
213          else
214          {
215            serverLevel = 2;
216            poolId = rank - serverSize_ + nbPools;
217            myColor = rank;
218          }
219          MPI_Comm_split(localComm, myColor, rank, &intraComm) ;
220
221        }
222        MPI_Comm_rank(intraComm,&rank_) ;
223        MPI_Comm_size(intraComm,&size) ;
224
225        string codesId=CXios::getin<string>("oasis_codes_id") ;
226
227        vector<string> splitted ;
228        boost::split( splitted, codesId, boost::is_any_of(","), boost::token_compress_on ) ;
229        vector<string>::iterator it ;
230
231        MPI_Comm newComm ;
232        int globalRank ;
233        MPI_Comm_rank(CXios::globalComm,&globalRank);
234
235        for(it=splitted.begin();it!=splitted.end();it++)
236        {
237          oasis_get_intercomm(newComm,*it) ;
238//        interComm.push_back(newComm) ;
239          if ( !CXios::usingServer2)
240            interCommLeft.push_back(newComm) ;
241          else
242          {
243            if (serverLevel == 1)
244            {
245              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size
246                       <<" intraCommRank :"<<rank_<<"  clientLeader "<< rank<<endl ;
247              MPI_Intercomm_create(intraComm, 0, localComm, rank, 0, &newComm) ;
248              interCommRight.push_back(newComm) ;
249
250            }
251            else if (serverLevel == 2)
252            {
253              info(50)<<"intercommCreate::server "<<rank_<<" intraCommSize : "<<size
254                       <<" intraCommRank :"<<rank_<<"  clientLeader "<< 0<<endl ;
255              MPI_Intercomm_create(intraComm, 0, localComm, 0, 0, &newComm) ;
256              interCommLeft.push_back(newComm) ;
257
258            }
259
260          }
261//          if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,newComm) ;
262//          MPI_Comm_remote_size(newComm,&size);
263          // Send serverLeader to client
264          if (rank_==0) MPI_Send(&globalRank,1,MPI_INT,0,0,interCommLeft.back()) ;
265        }
266              oasis_enddef() ;
267      }
268
269      MPI_Comm_rank(intraComm, &rank_) ;
270      if (rank_==0) isRoot=true;
271      else isRoot=false;
272     
273      eventScheduler = new CEventScheduler(intraComm) ;
274    }
275
276    void CServer::finalize(void)
277    {
278
279      CTimer::get("XIOS").suspend() ;
280     
281      delete eventScheduler ;
282
283      for (std::list<MPI_Comm>::iterator it = contextInterComms.begin(); it != contextInterComms.end(); it++)
284        MPI_Comm_free(&(*it));
285
286      for (std::list<MPI_Comm>::iterator it = contextIntraComms.begin(); it != contextIntraComms.end(); it++)
287        MPI_Comm_free(&(*it));
288
289//      for (std::list<MPI_Comm>::iterator it = interComm.begin(); it != interComm.end(); it++)
290//        MPI_Comm_free(&(*it));
291
292//        for (std::list<MPI_Comm>::iterator it = interCommLeft.begin(); it != interCommLeft.end(); it++)
293//          MPI_Comm_free(&(*it));
294
295        for (std::list<MPI_Comm>::iterator it = interCommRight.begin(); it != interCommRight.end(); it++)
296          MPI_Comm_free(&(*it));
297
298      MPI_Comm_free(&intraComm);
299
300      if (!is_MPI_Initialized)
301      {
302        if (CXios::usingOasis) oasis_finalize();
303        else MPI_Finalize() ;
304      }
305      report(0)<<"Performance report : Time spent for XIOS : "<<CTimer::get("XIOS server").getCumulatedTime()<<endl  ;
306      report(0)<<"Performance report : Time spent in processing events : "<<CTimer::get("Process events").getCumulatedTime()<<endl  ;
307      report(0)<<"Performance report : Ratio : "<<CTimer::get("Process events").getCumulatedTime()/CTimer::get("XIOS server").getCumulatedTime()*100.<<"%"<<endl  ;
308    }
309
310     void CServer::eventLoop(void)
311     {
312       bool stop=false ;
313
314       CTimer::get("XIOS server").resume() ;
315       while(!stop)
316       {
317
318         if (isRoot)
319         {
320           listenContext();
321           if (!finished) listenFinalize() ;
322         }
323         else
324         {
325           listenRootContext();
326           if (!finished) listenRootFinalize() ;
327         }
328
329         contextEventLoop() ;
330         if (finished && contextList.empty()) stop=true ;
331         eventScheduler->checkEvent() ;
332
333       }
334       CTimer::get("XIOS server").suspend() ;
335     }
336
337     void CServer::listenFinalize(void)
338     {
339        list<MPI_Comm>::iterator it, itr;
340        int msg ;
341        int flag ;
342
343        for(it=interCommLeft.begin();it!=interCommLeft.end();it++)
344        {
345           MPI_Status status ;
346           traceOff() ;
347           MPI_Iprobe(0,0,*it,&flag,&status) ;
348           traceOn() ;
349           if (flag==true)
350           {
351              MPI_Recv(&msg,1,MPI_INT,0,0,*it,&status) ;
352              info(20)<<" CServer : Receive client finalize"<<endl ;
353              // Sending server finalize message to secondary servers (if any)
354              for(itr=interCommRight.begin();itr!=interCommRight.end();itr++)
355              {
356                MPI_Send(&msg,1,MPI_INT,0,0,*itr) ;
357              }
358              MPI_Comm_free(&(*it));
359              interCommLeft.erase(it) ;
360              break ;
361            }
362         }
363
364         if (interCommLeft.empty())
365         {
366           int i,size ;
367           MPI_Comm_size(intraComm,&size) ;
368           MPI_Request* requests= new MPI_Request[size-1] ;
369           MPI_Status* status= new MPI_Status[size-1] ;
370
371           for(int i=1;i<size;i++) MPI_Isend(&msg,1,MPI_INT,i,4,intraComm,&requests[i-1]) ;
372           MPI_Waitall(size-1,requests,status) ;
373
374           finished=true ;
375           delete [] requests ;
376           delete [] status ;
377         }
378     }
379
380
381     void CServer::listenRootFinalize()
382     {
383        int flag ;
384        MPI_Status status ;
385        int msg ;
386
387        traceOff() ;
388        MPI_Iprobe(0,4,intraComm, &flag, &status) ;
389        traceOn() ;
390        if (flag==true)
391        {
392           MPI_Recv(&msg,1,MPI_INT,0,4,intraComm,&status) ;
393           finished=true ;
394        }
395      }
396
397     void CServer::listenContext(void)
398     {
399
400       MPI_Status status ;
401       int flag ;
402       static void* buffer ;
403       static MPI_Request request ;
404       static bool recept=false ;
405       int rank ;
406       int count ;
407
408       if (recept==false)
409       {
410         traceOff() ;
411         MPI_Iprobe(MPI_ANY_SOURCE,1,CXios::globalComm, &flag, &status) ;
412         traceOn() ;
413         if (flag==true)
414         {
415           rank=status.MPI_SOURCE ;
416           MPI_Get_count(&status,MPI_CHAR,&count) ;
417           buffer=new char[count] ;
418           MPI_Irecv(buffer,count,MPI_CHAR,rank,1,CXios::globalComm,&request) ;
419           recept=true ;
420         }
421       }
422       else
423       {
424         traceOff() ;
425         MPI_Test(&request,&flag,&status) ;
426         traceOn() ;
427         if (flag==true)
428         {
429           rank=status.MPI_SOURCE ;
430           MPI_Get_count(&status,MPI_CHAR,&count) ;
431           recvContextMessage(buffer,count) ;
432           delete [] buffer;
433           recept=false ;
434         }
435       }
436     }
437
438     void CServer::recvContextMessage(void* buff,int count)
439     {
440       static map<string,contextMessage> recvContextId;
441       map<string,contextMessage>::iterator it ;
442       CBufferIn buffer(buff,count) ;
443       string id ;
444       int clientLeader ;
445       int nbMessage ;
446
447       buffer>>id>>nbMessage>>clientLeader ;
448
449       it=recvContextId.find(id) ;
450       if (it==recvContextId.end())
451       {
452         contextMessage msg={0,0} ;
453         pair<map<string,contextMessage>::iterator,bool> ret ;
454         ret=recvContextId.insert(pair<string,contextMessage>(id,msg)) ;
455         it=ret.first ;
456       }
457       it->second.nbRecv+=1 ;
458       it->second.leaderRank+=clientLeader ;
459
460       if (it->second.nbRecv==nbMessage)
461       {
462         int size ;
463         MPI_Comm_size(intraComm,&size) ;
464         MPI_Request* requests= new MPI_Request[size-1] ;
465         MPI_Status* status= new MPI_Status[size-1] ;
466
467         for(int i=1;i<size;i++)
468         {
469            MPI_Isend(buff,count,MPI_CHAR,i,2,intraComm,&requests[i-1]) ;
470         }
471         MPI_Waitall(size-1,requests,status) ;
472         registerContext(buff,count,it->second.leaderRank) ;
473
474         recvContextId.erase(it) ;
475         delete [] requests ;
476         delete [] status ;
477
478       }
479     }
480
481     void CServer::listenRootContext(void)
482     {
483       MPI_Status status ;
484       int flag ;
485       static void* buffer ;
486       static MPI_Request request ;
487       static bool recept=false ;
488       int rank ;
489       int count ;
490       const int root=0 ;
491
492       if (recept==false)
493       {
494         traceOff() ;
495         MPI_Iprobe(root,2,intraComm, &flag, &status) ;
496         traceOn() ;
497         if (flag==true)
498         {
499           MPI_Get_count(&status,MPI_CHAR,&count) ;
500           buffer=new char[count] ;
501           MPI_Irecv(buffer,count,MPI_CHAR,root,2,intraComm,&request) ;
502           recept=true ;
503         }
504       }
505       else
506       {
507         MPI_Test(&request,&flag,&status) ;
508         if (flag==true)
509         {
510           MPI_Get_count(&status,MPI_CHAR,&count) ;
511           registerContext(buffer,count) ;
512           delete [] buffer ;
513           recept=false ;
514         }
515       }
516     }
517
518     void CServer::registerContext(void* buff, int count, int leaderRank)
519     {
520       string contextId;
521       CBufferIn buffer(buff, count);
522       buffer >> contextId;
523       CContext* context;
524
525       info(20) << "CServer : Register new Context : " << contextId << endl;
526
527       if (contextList.find(contextId) != contextList.end())
528         ERROR("void CServer::registerContext(void* buff, int count, int leaderRank)",
529               << "Context '" << contextId << "' has already been registred");
530
531       context=CContext::create(contextId);
532       contextList[contextId]=context;
533
534       // Primary or classical server: initialize its own server (CContextServer)
535       MPI_Comm inter;
536       if (serverLevel < 2)
537       {
538         MPI_Comm contextInterComm;
539         MPI_Intercomm_create(intraComm, 0, CXios::globalComm, leaderRank, 10+leaderRank, &contextInterComm);
540         MPI_Intercomm_merge(contextInterComm,1,&inter);
541         MPI_Barrier(inter);
542         MPI_Comm_free(&inter);
543         context->initServer(intraComm,contextInterComm);
544         contextInterComms.push_back(contextInterComm);
545
546       }
547       // Secondary server: initialize its own server (CContextServer)
548       else if (serverLevel == 2)
549       {
550         MPI_Comm_dup(interCommLeft.front(), &inter);
551         contextInterComms.push_back(inter);
552         context->initServer(intraComm, contextInterComms.back());
553       }
554
555       // Primary server: send create context message to secondary servers and initialize its own client (CContextClient)
556       if (serverLevel == 1)
557       {
558         int i = 0, size;
559         CMessage msg;
560         int messageSize;
561         MPI_Comm_size(intraComm, &size) ;
562         for (std::list<MPI_Comm>::iterator it = interCommRight.begin(); it != interCommRight.end(); it++, ++i)
563         {
564           StdString str = contextId +"_server_" + boost::lexical_cast<string>(i);
565           msg<<str<<size<<rank_ ;
566           messageSize = msg.size() ;
567           buff = new char[messageSize] ;
568           CBufferOut buffer(buff,messageSize) ;
569           buffer<<msg ;
570           int sndServerGloRanks = serverSize_-nbPools+serverLeader_ +i;  // the assumption is that there is only one proc per secondary server pool
571           MPI_Send(buff, buffer.count(), MPI_CHAR, sndServerGloRanks, 1, CXios::globalComm) ;
572           MPI_Comm_dup(*it, &inter);
573           contextInterComms.push_back(inter);
574           MPI_Comm_dup(intraComm, &inter);
575           contextIntraComms.push_back(inter);
576           context->initClient(contextIntraComms.back(), contextInterComms.back()) ;
577           delete [] buff ;
578         }
579         ++nbContexts_;
580       }
581     }
582
583     void CServer::contextEventLoop(void)
584     {
585       bool isFinalized ;
586
587       map<string,CContext*>::iterator it ;
588
589       for(it=contextList.begin();it!=contextList.end();it++)
590       {
591         isFinalized=it->second->isFinalized();
592         if (isFinalized)
593         {
594           it->second->postFinalize();
595           contextList.erase(it) ;
596           break ;
597         }
598         else
599         {
600           isFinalized=it->second->checkBuffersAndListen();
601         }
602       }
603     }
604
605     //! Get rank of the current process
606     int CServer::getRank()
607     {
608       return rank_;
609     }
610
611    /*!
612    * Open a file specified by a suffix and an extension and use it for the given file buffer.
613    * The file name will be suffix+rank+extension.
614    *
615    * \param fileName[in] protype file name
616    * \param ext [in] extension of the file
617    * \param fb [in/out] the file buffer
618    */
619    void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)
620    {
621      StdStringStream fileNameClient;
622      int numDigit = 0;
623      int size = 0;
624      int id;
625      MPI_Comm_size(CXios::globalComm, &size);
626      while (size)
627      {
628        size /= 10;
629        ++numDigit;
630      }
631
632      if (!CXios::usingServer2)
633        id = getRank();
634      else
635      {
636        if (serverLevel == 1)
637          id = rank_;
638        else
639          id = poolId;
640      }
641      fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << id << ext;
642      fb->open(fileNameClient.str().c_str(), std::ios::out);
643      if (!fb->is_open())
644        ERROR("void CServer::openStream(const StdString& fileName, const StdString& ext, std::filebuf* fb)",
645              << std::endl << "Can not open <" << fileNameClient << "> file to write the server log(s).");
646    }
647
648    /*!
649    * \brief Open a file stream to write the info logs
650    * Open a file stream with a specific file name suffix+rank
651    * to write the info logs.
652    * \param fileName [in] protype file name
653    */
654    void CServer::openInfoStream(const StdString& fileName)
655    {
656      std::filebuf* fb = m_infoStream.rdbuf();
657      openStream(fileName, ".out", fb);
658
659      info.write2File(fb);
660      report.write2File(fb);
661    }
662
663    //! Write the info logs to standard output
664    void CServer::openInfoStream()
665    {
666      info.write2StdOut();
667      report.write2StdOut();
668    }
669
670    //! Close the info logs file if it opens
671    void CServer::closeInfoStream()
672    {
673      if (m_infoStream.is_open()) m_infoStream.close();
674    }
675
676    /*!
677    * \brief Open a file stream to write the error log
678    * Open a file stream with a specific file name suffix+rank
679    * to write the error log.
680    * \param fileName [in] protype file name
681    */
682    void CServer::openErrorStream(const StdString& fileName)
683    {
684      std::filebuf* fb = m_errorStream.rdbuf();
685      openStream(fileName, ".err", fb);
686
687      error.write2File(fb);
688    }
689
690    //! Write the error log to standard error output
691    void CServer::openErrorStream()
692    {
693      error.write2StdErr();
694    }
695
696    //! Close the error log file if it opens
697    void CServer::closeErrorStream()
698    {
699      if (m_errorStream.is_open()) m_errorStream.close();
700    }
701}
Note: See TracBrowser for help on using the repository browser.