7
7
* Distributed under the MIT software license, see the accompanying
8
8
* file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9
9
*
10
- * see full documentation about SAM at http://www.i2p2.i2p/samv3.html
10
+ * See full documentation about SAM at http://www.i2p2.i2p/samv3.html
11
11
*/
12
12
13
13
#include < ctime>
@@ -192,7 +192,7 @@ void I2pSocket::close()
192
192
::closesocket (socket_);
193
193
#else
194
194
::close (socket_);
195
- #endif
195
+ #endif // WIN32
196
196
socket_ = INVALID_SOCKET;
197
197
}
198
198
}
@@ -223,7 +223,7 @@ SAMSession::SAMSession(
223
223
{
224
224
#ifdef DEBUG_ON_STDOUT
225
225
std::cout << " Created a brand new SAM stream session (" << sessionID_ << " )" << std::endl;
226
- #endif
226
+ #endif // DEBUG_ON_STDOUT
227
227
}
228
228
229
229
SAMSession::SAMSession (SAMSession& rhs)
@@ -238,7 +238,7 @@ SAMSession::SAMSession(SAMSession& rhs)
238
238
rhs.socket_ .close ();
239
239
#ifdef DEBUG_ON_STDOUT
240
240
std::cout << " Created a new SAM session (" << sessionID_ << " ) from another (" << rhs.sessionID_ << " )" << std::endl;
241
- #endif
241
+ #endif // DEBUG_ON_STDOUT
242
242
}
243
243
244
244
/* static*/
@@ -260,7 +260,7 @@ std::string SAMSession::generateSessionID()
260
260
261
261
#ifdef DEBUG_ON_STDOUT
262
262
std::cout << " Generated session ID: " << result << std::endl;
263
- #endif
263
+ #endif // DEBUG_ON_STDOUT
264
264
return result;
265
265
}
266
266
@@ -308,12 +308,12 @@ RequestResult<const FullDestination> SAMSession::destGenerate() const
308
308
309
309
FullDestination SAMSession::createSession (const std::string& destination)
310
310
{
311
- return createSession (destination, SAM_SIGNATURE_TYPE);
311
+ return createSession (destination, SAM_SIGNATURE_TYPE);
312
312
}
313
313
314
314
FullDestination SAMSession::createSession (const std::string& destination, const std::string& sigType)
315
315
{
316
- return createSession (destination, sigType, i2pOptions_);
316
+ return createSession (destination, sigType, i2pOptions_);
317
317
}
318
318
319
319
void SAMSession::fallSick () const { isSick_ = true ; }
@@ -462,7 +462,7 @@ StreamSession::StreamSession(
462
462
myDestination_ = createStreamSession (destination);
463
463
#ifdef DEBUG_ON_STDOUT
464
464
std::cout << " Created a brand new SAM stream session (" << sessionID_ << " )" << std::endl;
465
- #endif
465
+ #endif // DEBUG_ON_STDOUT
466
466
}
467
467
468
468
StreamSession::StreamSession (StreamSession &rhs)
@@ -477,15 +477,15 @@ StreamSession::StreamSession(StreamSession &rhs)
477
477
478
478
#ifdef DEBUG_ON_STDOUT
479
479
std::cout << " Created a new SAM stream session (" << sessionID_ << " ) from another (" << rhs.sessionID_ << " )" << std::endl;
480
- #endif
480
+ #endif // DEBUG_ON_STDOUT
481
481
}
482
482
483
483
StreamSession::~StreamSession ()
484
484
{
485
485
stopForwardingAll ();
486
486
#ifdef DEBUG_ON_STDOUT
487
487
std::cout << " Closing SAM stream session (" << sessionID_ << " ) ..." << std::endl;
488
- #endif
488
+ #endif // DEBUG_ON_STDOUT
489
489
}
490
490
491
491
RequestResult<std::unique_ptr<I2pSocket>> StreamSession::accept (bool silent)
@@ -678,7 +678,7 @@ DatagramSession::DatagramSession(
678
678
myDestination_ = createDatagramSession (destination);
679
679
#ifdef DEBUG_ON_STDOUT
680
680
std::cout << " Created a brand new SAM datagram session (" << sessionID_ << " )" << std::endl;
681
- #endif
681
+ #endif // DEBUG_ON_STDOUT
682
682
}
683
683
684
684
DatagramSession::DatagramSession (DatagramSession &rhs)
@@ -692,24 +692,24 @@ DatagramSession::DatagramSession(DatagramSession &rhs)
692
692
693
693
#ifdef DEBUG_ON_STDOUT
694
694
std::cout << " Created a new SAM datagram session (" << sessionID_ << " ) from another (" << rhs.sessionID_ << " )" << std::endl;
695
- #endif
695
+ #endif // DEBUG_ON_STDOUT
696
696
}
697
697
698
698
DatagramSession::~DatagramSession ()
699
699
{
700
700
#ifdef DEBUG_ON_STDOUT
701
701
std::cout << " Closing SAM datagram session (" << sessionID_ << " ) ..." << std::endl;
702
- #endif
702
+ #endif // DEBUG_ON_STDOUT
703
703
}
704
704
705
705
FullDestination DatagramSession::createDatagramSession (const std::string& destination)
706
706
{
707
- return createDatagramSession (destination, SAM_SIGNATURE_TYPE);
707
+ return createDatagramSession (destination, SAM_SIGNATURE_TYPE);
708
708
}
709
709
710
710
FullDestination DatagramSession::createDatagramSession (const std::string& destination, const std::string& sigType)
711
711
{
712
- return createDatagramSession (destination, sigType, i2pOptions_);
712
+ return createDatagramSession (destination, sigType, i2pOptions_);
713
713
}
714
714
715
715
FullDestination DatagramSession::createDatagramSession (const std::string& destination, const std::string& sigType, const std::string& i2pOptions)
@@ -778,7 +778,7 @@ RawSession::RawSession(
778
778
myDestination_ = createRawSession (destination);
779
779
#ifdef DEBUG_ON_STDOUT
780
780
std::cout << " Created a brand new SAM datagram session (" << sessionID_ << " )" << std::endl;
781
- #endif
781
+ #endif // DEBUG_ON_STDOUT
782
782
}
783
783
784
784
RawSession::RawSession (RawSession &rhs)
@@ -791,14 +791,14 @@ RawSession::RawSession(RawSession &rhs)
791
791
(void ) createRawSession (myDestination_.priv );
792
792
#ifdef DEBUG_ON_STDOUT
793
793
std::cout << " Created a new SAM datagram session (" << sessionID_ << " ) from another (" << rhs.sessionID_ << " )" << std::endl;
794
- #endif
794
+ #endif // DEBUG_ON_STDOUT
795
795
}
796
796
797
797
RawSession::~RawSession ()
798
798
{
799
799
#ifdef DEBUG_ON_STDOUT
800
800
std::cout << " Closing SAM datagram session (" << sessionID_ << " ) ..." << std::endl;
801
- #endif
801
+ #endif // DEBUG_ON_STDOUT
802
802
}
803
803
804
804
FullDestination RawSession::createRawSession (const std::string& destination)
@@ -1221,22 +1221,26 @@ int i2psam_is_sick(struct i2psam_stream_session *session)
1221
1221
struct i2psam_socket *i2psam_accept (struct i2psam_stream_session *session, int silent)
1222
1222
{
1223
1223
auto result = session->impl ->accept (silent);
1224
- if (result.isOk ) {
1225
- struct i2psam_socket *socket = new i2psam_socket;
1226
- socket->impl = std::move (result.value );
1227
- return socket;
1228
- } else
1224
+ if (result.isOk )
1225
+ {
1226
+ struct i2psam_socket *socket = new i2psam_socket;
1227
+ socket->impl = std::move (result.value );
1228
+ return socket;
1229
+ }
1230
+ else
1229
1231
return nullptr ;
1230
1232
}
1231
1233
1232
1234
struct i2psam_socket *i2psam_connect (struct i2psam_stream_session *session, const char *destination, int silent)
1233
1235
{
1234
1236
auto result = session->impl ->connect (destination, silent != 0 );
1235
- if (result.isOk ) {
1236
- struct i2psam_socket *socket = new i2psam_socket;
1237
- socket->impl = std::move (result.value );
1238
- return socket;
1239
- } else
1237
+ if (result.isOk )
1238
+ {
1239
+ struct i2psam_socket *socket = new i2psam_socket;
1240
+ socket->impl = std::move (result.value );
1241
+ return socket;
1242
+ }
1243
+ else
1240
1244
return nullptr ;
1241
1245
}
1242
1246
0 commit comments