|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: TCP sender |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "cncmtcpsender.h" |
|
22 #include "ncmconnectionmultiplexerlogs.h" |
|
23 #include "cncmsenditem.h" |
|
24 |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // CNcmTcpSender::CNcmTcpSender |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CNcmTcpSender::CNcmTcpSender( RSocket& aSocket, |
|
31 MNcmReceiverSenderObserver& aObserver ) : |
|
32 CNcmSender( aSocket, aObserver ) |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CNcmTcpSender::NewL |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CNcmTcpSender* CNcmTcpSender::NewL( RSocket& aSocket, |
|
42 MNcmReceiverSenderObserver& aObserver ) |
|
43 { |
|
44 __CONNECTIONMULTIPLEXER( "CNcmTcpSender::NewL" ) |
|
45 |
|
46 CNcmTcpSender* self = CNcmTcpSender::NewLC( aSocket, aObserver ); |
|
47 CleanupStack::Pop( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CNcmTcpSender::NewLC |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CNcmTcpSender* CNcmTcpSender::NewLC( RSocket& aSocket, |
|
57 MNcmReceiverSenderObserver& aObserver ) |
|
58 { |
|
59 __CONNECTIONMULTIPLEXER( "CNcmTcpSender::NewLC" ) |
|
60 |
|
61 CNcmTcpSender* self = new( ELeave ) CNcmTcpSender( aSocket, aObserver ); |
|
62 CleanupStack::PushL( self ); |
|
63 return self; |
|
64 } |
|
65 |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // CNcmTcpSender::~CNcmTcpSender |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CNcmTcpSender::~CNcmTcpSender() |
|
72 { |
|
73 __CONNECTIONMULTIPLEXER( "CNcmTcpSender::~CNcmTcpSender" ) |
|
74 } |
|
75 |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // From class CNcmSender |
|
79 // |
|
80 // DoSend |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CNcmTcpSender::DoSend() |
|
84 { |
|
85 __CONNECTIONMULTIPLEXER( "CNcmTcpSender::DoSend" ) |
|
86 |
|
87 TInt count = iSendItemArray.Count(); |
|
88 |
|
89 if ( count && !IsActive() ) |
|
90 { |
|
91 // Send oldest message |
|
92 iSendItemArray[0]->SetSendInProgress( ETrue ); |
|
93 iSocket.Send( iSendItemArray[0]->Data(), 0, iStatus ); |
|
94 SetActive(); |
|
95 } |
|
96 } |